Active
Project:
Ajax views refresh
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2011 at 12:15 UTC
Updated:
15 Oct 2011 at 17:43 UTC
Hi,
I'm using php to print a view and after a submit on comment the view (only list comments) doesn't get refreshed.
$view = views_get_view('myview');
print $view->execute_display('block-1', array($node->nid));
the ajax views refresh settings page are ok.
Any help?
thanks
Comments
Comment #1
carvalhar commentedIf i print_r($form) i can see that the form has the views_refresh array itens:
[#ajax] => Array
(
[enabled] => 1
[disable_redirect] => 1
[remove_form] =>
[scroller] =>
[views_refresh] => 1
[views_refresh_enabled] => Array
(
[comentarios] => comentarios
[comentarios:block_1] => comentarios:block_1
)
)
so far i couldn't tell what's avoind the view refresh.
any help?
Comment #2
carvalhar commentedi resolved this manually, but with this module i couldn't.
more info here:
http://drupal.org/node/1246672
Comment #3
twistedindustries commentedI am having the same issue and looked through the topic posted above but didn't really see any obvious fix. Any chance you could post what you did to fix it? I am seeing that all the views that it detects on the page are added to Drupal.settings. Does anyone know where that is done in this module and maybe we can look at modifying that? It seems as though it doesn't detect the page it is on as a view.
Comment #4
carvalhar commentedsorry, i did my own ajax call...
See http://drupal.org/node/1246672#comment-4856824 then i added :
$('#mycontainer).html(data.display);
Drupal.attachBehaviors($('#mycontainer'));
Comment #5
jthomasbailey commentedCarvalhar, would you mind pasting the exact code you used in template.php and the views embed code you used in node.tpl.php? I'm having a hard time understanding what you did.
Comment #6
carvalhar commentedok, i'm pasting here, as a reference. From august (when i posted it here) to today, many things changed.
You'll need to create a JS plugin, adding a custom.js to your theme:
My tpl has an input hidden with the ajax full url, i'm using i18n:
But at the beginning i was using a preprocess function to add the view to my tpl, in template.php
Comment #7
jthomasbailey commentedHey thanks a lot, you saved me and probably a lot of other people some serious hair pulling.