Am using kartik editable grid column , the data is updated successifully on the server database but on the grid view its not.
The editable column doesnt refresh the value on the grid view but when i refresh the page manually the value is there
This is my code:
if (Yii::$app->request->post('hasEditable')) {
// instantiate your book model for saving
$truckid = Yii::$app->request->post('editableKey');
$model = Truck::findOne($truckid);
$out = Json::encode(['output'=>'', 'message'=>'']);
$posted = current($_POST['Truck']);
$post = ['Truck' => $posted];
// load model like any single model validation
if ($model->load($post)) {
// can save model or do something before saving model
$model->save();
$output = '';
if (isset($posted['reg_no'])) {
$output = $posted['reg_no'];
}
$out = Json::encode(['output'=>$output, 'message'=>'successifully saved']);
}
// return ajax json encoded response and exit
echo $out;
return;
}
This is my grid view code:
[
'class'=>'kartikgridEditableColumn',
'attribute' => 'reg_no',
'header' => 'Truck registration number',
'editableOptions'=>[
'formOptions' => ['action' => ['truckyard']],
'header'=>'Registration number',
'inputType'=>Editable::INPUT_TEXTAREA,
//'options'=>['mask' => 'aaa-999a']
],
'hAlign'=>'left',
'vAlign'=>'middle',
'filterType'=>GridView::FILTER_SELECT2,
'filter'=>ArrayHelper::map(Truck::find()->orderBy('id')->asArray()->all(), 'id', 'reg_no'),
'filterWidgetOptions'=>[
'pluginOptions'=>['allowClear'=>true],
],
'filterInputOptions'=>['placeholder'=>'Select truck'],
'format'=>'raw'
],
What could be wrong
