Browse Source

Added SerialColumn to crud generated code.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
7d2d925dbe
  1. 6
      framework/yii/gii/generators/crud/templates/views/index.php
  2. 2
      framework/yii/grid/SerialColumn.php

6
framework/yii/gii/generators/crud/templates/views/index.php

@ -43,6 +43,8 @@ $this->params['breadcrumbs'][] = $this->title;
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
'columns' => array( 'columns' => array(
array('class' => 'yii\grid\SerialColumn'),
<?php <?php
$count = 0; $count = 0;
foreach ($generator->getTableSchema()->columns as $column) { foreach ($generator->getTableSchema()->columns as $column) {
@ -55,9 +57,7 @@ foreach ($generator->getTableSchema()->columns as $column) {
} }
?> ?>
array( array('class' => 'yii\grid\ActionColumn'),
'class' => 'yii\grid\ActionColumn',
),
), ),
)); ?> )); ?>
<?php else: ?> <?php else: ?>

2
framework/yii/grid/SerialColumn.php

@ -15,6 +15,8 @@ namespace yii\grid;
*/ */
class SerialColumn extends Column class SerialColumn extends Column
{ {
public $header = '#';
/** /**
* Renders the data cell content. * Renders the data cell content.
* @param mixed $model the data model * @param mixed $model the data model

Loading…
Cancel
Save