gridview - Get the absolute row number in a grid -


in yii's cgridview can current row number using $row. returns row index within current page only. need absolute row number among pages.

i using yii, dreams should come true "easily", expect answer should not guide me add special field data provider or access pager , current page number , multiply numbers bla bla bla.

thanks

have solved this? if not, offer following solution

$this->widget(   'zii.widgets.grid.cgridview',   array(     'columns'=>array(       array(         'header'=>'no.',         'value'=>'$this->grid->dataprovider->pagination->currentpage * $this->grid->dataprovider->pagination->pagesize + ($row+1)',       ),     ),   )); 

basically can access currentpage , pagesize variables dataprovider , use calculate 'row number' whole data. why $row + 1? because $row starts 0. hope helps :d


Comments