Using ClistView (with pagination) in widget. How to reload ClistView in widget?

Hello everyone!

I would like to learn how you can implement the following problem:

I need to create widget with kinda live filtering (user typing smth. in input field and widget load filtered data).

For example:

in Index view (which use actionIndex of SiteController) I use widget (<input> + ClistView with pagination).

Widget goal: load filtered CListView (when user typing some words in <input> … ajax takes place and loads new ClistView which now contains filtered data)

But Widget runs from actionUpdateAjax of SiteController (not actionIndex) to load filtered data and it causes several problems:

  1. Initially, the widget runs in the Site/Index

and links in pagination looks like /site/Index?page=2

because dataProviderConv first cretaes in renderContent method in widget:

//convList widget 

protected function renderContent()



        $this->render('convList', array(


                                'data' => $data, 


but after updating via ajax: links in pagination looks like /site/UpdateAjax?page=2 (because widget run from UpdateAjax action of SiteController)

How could I fix this problem?

  1. I tried to fix it using this code:

//_ajaxContent view


                'route'=>$route, //$route looks like 'controller/view'



It didn’t work properly

  1. of course I could use actionIndex to load filtered data… but in this way I need to rewrite all controllers (in wich I want to use widget) to add UpdateAjax functionality

[b]Main question:

Is there any way to load (reload) filtered CListView with pagination in widget (using ajax)? If I create dataProvider for CListView in other controller[/b]

//convList widget view:

<?php if (Yii::app()->request->isAjaxRequest): ?>

<div id="data" style='clear:both;'>


$this->render('_ajaxContent', array(



        , false, true); 



<?php else: ?>

                echo CHtml::textField(


                        'start typing to filter...',







                                                'url'=> Yii::app()->createUrl('site/UpdateAjax'),








<div id="data" style='clear:both;'>


$this->render('_ajaxContent', array(



        ), false, true); 



<?php endif; ?>

Another question:

How to place two different logics in one view?

For exampe, how to render one part of web page from one controller and another part from another controlle… renderPartial dosen’t solve this problem

Widget is a kind of solution, but not in every case (like in example above… in first post).