Javascript Widgets Via Ajax (Cjuisliderinput)

Hi,

We have a listview with infiniteScroll extension, so new data is loaded when the user scrolls to the bottom of the page.

The problem is within the newly loaded views.

They contain a custom widget which internally renders a CJuiSliderInput.

When the new data is returned the views are shown on the page, only the Sliders are missing.

It gets rendered, i see them in the code itself. But the javascript used to run the slider is not returned or running.

Anyone got any suggestions on how to render javascript widgets and return them via ajax?

Thanks!

what I can recommend is leave everything as it is just attach the jquery slider call again in the loaded event of infinateScroll


$(".list-view .className").slider();

NOTE: this not a ideal solution but it will work, best thing do would be to delegate event down to the child elements if you have lot of records

great! thanks, it works!

I got my slider working.

But now a new problem occures,

the ‘slide’ function does not get called, i assume it is not return properly through ajax?

My widget setup:


            'name'=>'slider_'.$this->id,

            'value'=>0,

            'event'=>'change',

            'options'=>array(

                'min'=>0,

                'max'=>$this->totalItems,

                'animate'=>true,

                'colors' => array("#ff0000", "#00ff00", "#0000ff", "#00ffff"),


                // on slider change event

                'slide'=>'js:function(event,ui)

                {

                    var labels = [ '.$this->labels.' ];

                    $("#amount_'.$this->id.'").html(labels[ui.value]);

                }',

            ),