summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarim Ratib2012-11-15 18:17:58 (GMT)
committer Karim Ratib2012-11-15 18:17:58 (GMT)
commit19e84a7e65407e95cde82ad999ddadc89f3dbdec (patch)
tree239882e86c6b15935574e5460c127cfc75c304ef
parentd44f8af0465eccd0dcbeaae4686a3d4d4f89d6f2 (diff)
Fix auto-refresh with filters #1838082
-rw-r--r--views_autorefresh/views_autorefresh.js2
-rw-r--r--views_autorefresh/views_autorefresh.module5
2 files changed, 4 insertions, 3 deletions
diff --git a/views_autorefresh/views_autorefresh.js b/views_autorefresh/views_autorefresh.js
index baa68c5..d969756 100644
--- a/views_autorefresh/views_autorefresh.js
+++ b/views_autorefresh/views_autorefresh.js
@@ -59,7 +59,6 @@ Drupal.behaviors.views_autorefresh = {
settings
);
Drupal.settings.views_autorefresh[settings.view_name].view_args = viewData.view_args;
-
// Setup the click response with Drupal.ajax.
var element_settings = {};
element_settings.url = ajax_path;
@@ -97,6 +96,7 @@ Drupal.views_autorefresh.timer = function(view_name, anchor, target) {
viewData.view_display_id = Drupal.settings.views_autorefresh[view_name].incremental.view_display_id;
viewData.view_name = Drupal.settings.views_autorefresh[view_name].incremental.view_name;
}
+ viewData.autorefreshRequest = 'autorefreshRequest';
Drupal.settings.views_autorefresh[view_name].ajax.submit = viewData;
// If there's a ping URL, hit it first.
diff --git a/views_autorefresh/views_autorefresh.module b/views_autorefresh/views_autorefresh.module
index e16ac2d..8d7d158 100644
--- a/views_autorefresh/views_autorefresh.module
+++ b/views_autorefresh/views_autorefresh.module
@@ -67,7 +67,8 @@ function theme_views_autorefresh($variables) {
* Implementation of hook_views_ajax_data_alter().
*/
function views_autorefresh_views_ajax_data_alter(&$commands, $view) {
- if (!empty($view->autorefresh['incremental'])) {
+ $replace = isset($_REQUEST['autorefreshRequest']);
+ if ($replace && !empty($view->autorefresh['incremental'])) {
foreach ($commands as &$command) {
if ($command['command'] == 'insert' && $command['selector'] == ('.view-dom-id-' . $view->dom_id)) {
$command['command'] = 'viewsAutoRefreshIncremental';
@@ -75,7 +76,7 @@ function views_autorefresh_views_ajax_data_alter(&$commands, $view) {
}
}
}
- if (!empty($view->autorefresh['interval'])) {
+ if ($replace && !empty($view->autorefresh['interval'])) {
$commands[] = array(
'command' => 'viewsAutoRefreshTriggerUpdate',
'selector' => '.view-dom-id-' . $view->dom_id,