[support] refreshing jcarousel item list without page reload

Christopher M. Jones cjones at partialflow.com
Thu Nov 18 13:09:44 UTC 2010


You haven't said much about your use case. What content are you 
outputing? Is it a view, or something else? From what you've said so 
far, it sounds like you're building your dom structure and javascript 
completely from scratch. So you've got a lot of choices to make about 
how you build the carousel. Have a look at the documentation for jcarousel:

http://sorgalla.com/projects/jcarousel/

In particular, check out the section on dynamic content loading:

http://sorgalla.com/projects/jcarousel/#Dynamic-Content-Loading

And the examples of dynamic content loading:

http://sorgalla.com/projects/jcarousel/#Examples

Depending on how much content we're talking about, it may be good to 
load it all up in a view and output it into the DOM as normal. This 
keeps the content indexable. Use your jquery to read in the elements 
from the DOM and put them into the carousel. Your select list would then 
become an external control which you use to add and remove items from 
the carousel. But all of those items are already in dom for jcarousel to 
grab.

Again, depending on the complexity and amount of content we're talking 
about you may need to write logic to conditionally load and unload items 
from the carousel. If you've got too much loaded up then you may have 
performance issues.

If you wanted to get all ninja on this then you might create your view 
and expose a filter, then use ajax to rebuild the view with the selected 
filter and return results in JSON. There are ways to output a view in 
JSON. Template your view and use drupal_to_js to return the view object, 
or find a json display plugin. So, maybe your view has a page display, 
which is used to output the view as normal (for seo and for 
degradability). Add a second display which would output json. This is 
the one you GET in your ajax call with the filter parameters coming from 
the select list.

Once you've got the newly built view then you can add and remove nodes 
as needed.


On 11/18/2010 07:38 AM, Aldo Martinez Selleras wrote:
> Hello everybody, I'm developing a module that implements the jcarousel
> plugin from jQuery, and I need the item list is updated by changing the
> option of a select, without full page reload.
>
> Some idea of how can do this ?
>
> Thks in advanced
>
>


More information about the support mailing list