Daily Archives: July 17, 2022

Yii2: How to Create Editable Row in Gridview

Setup 1 – View Put the following code inside gridview: [ ‘class’=>’kartik\grid\EditableColumn’, ‘attribute’ => ‘nilai_tugas’, ‘value’ => function ($model) { return $model->nilai_tugas; }, ‘editableOptions’=> function ($model, $key, $index) { return [ ‘header’=>’Name’, ‘size’=>’md’, ‘formOptions’=>[‘action’ => [‘krs-detail/editNilai’]], ‘inputType’=>\kartik\editable\Editable::INPUT_TEXT, ]; } ], Setup 2 – Controller Put the following code into controller file: use kartik\grid\EditableColumnAction; use yii\helpers\ArrayHelper;…