diff --git a/framework/yii/gii/generators/crud/templates/views/index.php b/framework/yii/gii/generators/crud/templates/views/index.php index 5f55e84..df76581 100644 --- a/framework/yii/gii/generators/crud/templates/views/index.php +++ b/framework/yii/gii/generators/crud/templates/views/index.php @@ -43,6 +43,8 @@ $this->params['breadcrumbs'][] = $this->title; 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => array( + array('class' => 'yii\grid\SerialColumn'), + getTableSchema()->columns as $column) { @@ -55,9 +57,7 @@ foreach ($generator->getTableSchema()->columns as $column) { } ?> - array( - 'class' => 'yii\grid\ActionColumn', - ), + array('class' => 'yii\grid\ActionColumn'), ), )); ?> diff --git a/framework/yii/grid/SerialColumn.php b/framework/yii/grid/SerialColumn.php index 2fdb770..6a875ae 100644 --- a/framework/yii/grid/SerialColumn.php +++ b/framework/yii/grid/SerialColumn.php @@ -15,6 +15,8 @@ namespace yii\grid; */ class SerialColumn extends Column { + public $header = '#'; + /** * Renders the data cell content. * @param mixed $model the data model