From 7d2d925dbe1809e42dcb0bd4e006c7e6919e0b94 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 24 Sep 2013 21:50:08 -0400 Subject: [PATCH] Added SerialColumn to crud generated code. --- framework/yii/gii/generators/crud/templates/views/index.php | 6 +++--- framework/yii/grid/SerialColumn.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) 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