Reputation: 135
i want's to add ajax loader in my clistview pagination links.
how is it possible in yii pagination.
Thanks.
Upvotes: 1
Views: 1293
Reputation: 4013
You have to create two js functions: first to show loader and second to hide it and pass them to CListView.
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_post', // refers to the partial view named '_post'
'beforeAjaxUpdate' => 'function(id) { $(\'.loader\').show(); }'
'afterAjaxUpdate' => 'function(id) { $(\'.loader\').hide(); }'
'sortableAttributes'=>array(
'title',
'create_time'=>'Post Time',
),
));
Of course, you have to create div loader
in html structure with image and position.
Here you have reference:
http://www.yiiframework.com/doc/api/1.1/CListView#beforeAjaxUpdate-detail http://www.yiiframework.com/doc/api/1.1/CListView#afterAjaxUpdate-detail
Upvotes: 2