简体   繁体   中英

Yii How to add ajax-loading indicators clistview pagination links

i want's to add ajax loader in my clistview pagination links.

how is it possible in yii pagination.

Thanks.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM