Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2009 at 15:14 UTC
Updated:
20 Apr 2011 at 15:20 UTC
Hi merlinofchaos,
Would it be possible to update a block view after a particulair ajax event has updated the data that this view is pulling in? This idea came from one of the maintainers from the flag module that suggested I should be able piggy back of the Views ajax capabilities. Hence the request here.
Issue reference: http://drupal.org/node/368644#comment-1239887 (explains his thoughts on Views integration)
Moofie (flag maintainer) wasn't sure himself if maybe this could already be achieved with views.
Regards,
Marius
Comments
Comment #1
merlinofchaos commentedThe quick answer is yes, and the file that does it normally is ajax_view.js in the js directory. You will need to turn 'Use ajax' on; If you need a long answer detailing the javascript necessary that will take me a little longer, but in theory it should not be too difficult to study that file and figure out the command necessary to trigger a view refresh.
Comment #2
mariusooms commentedThanks Merlin, that's already a big help to get the ball rolling.
Regards,
Marius
Comment #3
paganwinter commentedSubscribing...
Comment #4
paganwinter commentedSubscribing...
There's a Block Refresh module which refreshes a blocks content using JS. It has now been ported for D6 too.
Using this in combination with the Block Refresh module, it should be easily possible.
I am right now trying it out and will let you know if I am able to get it done...
Edit: I was able to successfully update a Views block upon flagging/unflagging a node. Along with Block Refresh I used the following code snippet given at the above mentioned article.
Comment #5
chrisroditis commentedPlease allow me to expand on this issue by asking whether there is a more simple way to refresh a view, like calling a simple javascipt function with the id of the view as a parameter.
For us less inclined with ajax it would be heavens! I would appreciate any suggestions!
Comment #6
dgastudio commentedSubscribing...
Comment #7
youkho commentedSubscribe
Comment #8
dgastudio commenteddone via component and custom js. Thanks.
Comment #9
chrisroditis commentedcan you provide an example or a little more info please?
Comment #10
dgastudio commentedof course.
1. install module "component"
2. add this js code (in my case, in external js file.)
done.
Comment #11
chrisroditis commentedthanks, I'll give it a shot!
Comment #12
Andrew Gorokhovets commentedhttp://drupal.org/node/369693#comment-2350262
Not working for me
Comment #13
Andrew Gorokhovets commentedExcellent working examples here:
http://ucenter.googllers.com/home/space.php?uid=4&do=blog&id=54
Comment #14
Andrew Gorokhovets commentedComment #16
cpliakas commentedOne more resource, the Views Flag Refresh module automatically refreshes views via AJAX when certain flags are selected, so the code in that module is a good working example as well.
Thanks,
Chris
Comment #17
hlykos commentedsub
Comment #18
Makku01 commentedThe Link from comment above is broken. Any other idea how this could work?