i have gangguan model, have id_registrasi (not pk) in gangguan model, want edit id_registrasi in gridview using editable, pop windows give error message "internal server error" when refresh page (f5), column has successful changed. , problem cant handle error. .. controller
if(yii::$app->request->post('haseditable')){ $id = yii::$app->request->post('editablekey'); $model1 = $this->findmodel($id); $posted = current($_post['gangguan']); $model1->id_registrasi = $posted['id_registrasi']; $model1->save(false); $output = $model1->id_registrasi; $out = json::encode(['output'=>$output, 'message'=>'']); echo $out; return; } and column
[ 'class' => 'kartik\grid\editablecolumn', 'attribute'=>'id_registrasi', 'halign' => 'top', 'valign' => 'middle', 'width'=>'100px', 'headeroptions' => ['class' => 'kv-sticky-column'], 'contentoptions' => ['class' => 'kv-sticky-column'], 'footeroptions' => ['class' => 'kv-sticky-column'], 'pagesummary' => true, ],
use following in controller , should ok then.
use yii\helpers\json;
Comments
Post a Comment