[support] refreshing jcarousel item list without page reload

Christopher M. Jones cjones at partialflow.com
Thu Nov 18 22:06:47 UTC 2010


1. The last example I sent binds a function to the onchange event of the 
select element. Use that instead of inline javascript. It's just cleaner.

2. Did you look at the dynamic loading examples at sorgella.com? Also in 
a previous example (look back. you'll find it) I mentioned 
carousel.add(mymarkup). You can see this at work in the examples. This 
is what loads an item into the carousel. If I got the method wrong then 
pardon my poor memory.

--edit--
Looks from your function names like you are reading the examples. Look 
back at this:

for (i = 0; i < items.length; i++) {
         carousel.add(i+1, mycarousel_getItemHTML(items[i]));
     }

And compare to the example with external controls.

 From the below, it looks like your approach is wrong. You are trying to 
use the select onchange to hose the carousel and completely rebuild it 
from scratch. Of course, the dom structure is different now that the 
carousel has rewritten everything. So the selector you used to build the 
carousel, along with everything inside of it, is gone.

On 11/18/2010 04:34 PM, Aldo Martinez Selleras wrote:
> Could be something like that ?
>
> function mycarousel_itemLoadCallback(carousel, state, classification)
> {
>     var classification = $('#award-type-filter').val();
>     jQuery.get(
>          '/classification/' + classification,
>          function(xml) {
>              mycarousel_itemAddCallback(carousel, carousel.first,
> carousel.last, xml);
>          },
>          'xml'
>      );
> };
>
> function carousel() {
>      jQuery(document).ready(function() {
>          $('#profile-carousel').jcarousel({
>              vertical: true,
>              itemLoadCallback: mycarousel_itemLoadCallback
>          });
>      });
> }
>
> function trigger() {
>     carousel();
> }
>
> In the select I declare onchange=javascript:trigger();
>
> But, the carousel isn't regenerating :(
>
> And the URL /classification/$val() it is generating and changing, instead
> the XML result are OK, but the carousel not render again :(
>
>


More information about the support mailing list