Mike Mane
Mike Mane

Reputation: 1

Yii Framework: Pagation Callback Method

I have a CListView on a page and every time i navigate to page 2 or any other page I want to call a method that formats the view. But it do not seem to work every time I navigate to another page.

The Javascript method I want to call is called updateDivs()

Here is my list view widget

$this->widget('zii.widgets.CListView', array(
                                    'dataProvider' => $dataProvider,
                                    'itemView' => '_customview',
                                    'id' => 'bannerslist',
                                    'ajaxUpdate' => true,
                                    'afterAjaxUpdate' => ' updateDivs()',
                                    'enablePagination' => true,
                                    'itemsCssClass' => 'row banners-list',
                                    'summaryText' => 'Total ' . $pages->itemCount . ' Results Found',
                                    'pager' => array(
                                        'header' => '',
                                        'prevPageLabel' => '<',
                                        'nextPageLabel' => '>',
                                    ),
                                ));

Upvotes: 0

Views: 39

Answers (2)

Alina Shakya
Alina Shakya

Reputation: 5

Your problem is that, you missed to write js:function(id, data) which is significant to call a method.

You can use as follows :

'afterAjaxUpdate'=>'js:function(id, data) {updateDivs();}',

Look here for more info.

Upvotes: 0

SiZE
SiZE

Reputation: 2267

Please try this to test, it should works well.

'afterAjaxUpdate' => 'js:function(id,data){alert("test");}'

So if this code will works perfect then you should search problem in your updateDivs() function

Upvotes: 0

Related Questions