Reputation: 405
I am new to yii2
framework. I added a column in a table in the database and its value not appears in the gridview
(it gives me notset
). I don't want to regenerate the model, controller and views using gii
. How to do that?
Upvotes: 1
Views: 76
Reputation: 3450
You don't need to regenerate Models, Views and Controllers through Gii again. You can accomplish this by :
In your view file (probably index.php
)
...
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// your other attribute here
'your_new_column_name',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
...
Thats it.
Upvotes: 0
Reputation: 1150
If you don't want to regenerate your code with gii (perhaps because of changes you have made), you can still use gii's preview and diff functions to get hints what has to be added to your code and do it manually...
Upvotes: 3