I have installed kartik Yii 2 Editable extension make columns editable.
Working fine but the updated data does not store in databse.how to store it in database ?
index.php
[
'class' => 'kartik\grid\EditableColumn',
'editableOptions' => [
'header' => 'status',
'inputType' => Editable::INPUT_TEXT,
'type' => 'danger',
'placement' => 'right',
'options' => [
'pluginOptions' => ['min' => 0, 'max' => 5000]
]
],
'attribute' => 'status',
'hAlign' => 'center',
'label' => 'Status',
'filterType' => GridView::FILTER_SELECT2,
'filter' => [ 'Present' => 'Present', 'Absent' => 'Absent', 'Leave' => 'Leave',],
'filterInputOptions' => ['placeholder' => 'search by status'],
'filterWidgetOptions' => [
'pluginOptions' => ['allowClear' => true],
],
],
controller
public function actionIndex()
{
$searchModel = new AttendanceSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
if(isset($_POST['hasEditable'])){
$staffindex=$_POST['editableIndex'];
$status = $_POST['Attendance'][$staffindex]['status'];
$staffid=$_POST['editableKey'];
//save attendence
return true;
}
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}