Cgridview counter column

7 followers

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

some times we want to show the serialNo on cgridview .

$this->widget('zii.widgets.grid.CGridView', array(
 
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        array(
            'header'=>'Sr #',
            'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
        ),
       ............
));

Total 4 comments

#16295 report it
Rajith R at 2014/02/07 05:03am
@Nisanth thulasi

Good

#15680 report it
Dhamodharan R at 2013/12/06 05:47am
Great !!

Its really a great!!

#14251 report it
trond at 2013/07/30 04:51am
Simple but useful

Thanks.

#14221 report it
mahdi1986 at 2013/07/27 02:36pm
Thx

Thx for wiki,This is good ;)

Leave a comment

Please to leave your comment.

Write new article