
Below example showing you how to add the row number in cgridview widgets.
You just need add the following script inside the array columns.
array( 'header' => 'No.', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', ),
The completed example as below:
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'grid-row-number',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
array(
'header' => 'No.',
'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
),
'name',
'create_time'
)
));