Page View Caching Problem in drupal 7

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Riya_Nithal's picture

I have a page View and I have been manipulating the data inside the view using ajax. The changes get reflected in the database. The problem is when the page is refreshed, it shows the old cached data, even though I have set caching 'None' in the View .Also, when the cache is flushed, the actual data is displayed and please note that the logged users are using this page view

Can someone help me?

The code for displaying the view is as follows:

function narrative_production_schedule_block_refresh($date) {
$date_str = strtotime($date);
$view = views_get_view('production_schedule');
$view->is_cacheable = FALSE;
$replace_div = '';
if($date == 0) {
$view->set_display('left_block'); $view->is_cacheable = FALSE;
$view->execute();
$view->query->add_where("Left", 'field_data_field_schedule_date.field_schedule_date_value', $value = 0, $operator = '=');
$view->query->add_where("Left", 'field_data_field_schedule_date.field_schedule_date_value', $value = NULL, $operator = 'IS NULL');
$view->query->where["Left"]['type'] = 'OR';
$view->execute();
$result = $view->result;
$replace_div = theme('narrative_production_schedule_leftblock',array('result' =>$result));
}
else {
$args = array(0 => $date_str);
$view->set_arguments($args);
$view->set_display('week_block');
$view->execute();
$result = $view->result;
$replace_div = theme('narrative_production_schedule_block',array('result' =>$result));
}
return $replace_div;
}

Comments

I think you're assuming

merlinofchaos's picture

I think you're assuming caching when it's not. When the view is updated via AJAX it goes directly to the view to update, which does not get any of the wide variety of changes you're making to the view. The method you're using is simply incompatible with AJAX and you must disable it to use this.

problemas con la vista

osmel_calderon's picture

Tengo un codigo como el siguiente, quiero pasar un (argumento o parametro) a mi vista, pero no logro ver el resultado, ni en firebug, ni mucho menos en la vista, necesito conocer si debo en la vista declarar algun filtro o campo q espere el valor. Por favor, gracias.

$argumento =array('clave'=>'valor');
$display_id = 'default';
$vista= 'mi vista';
$view = views_get_view($vista);
$view->init_display($display_id);
//$view->is_cacheable = FALSE;
$view->set_arguments($argumento);
$view->pre_execute();
return $view->render();