Actually, here are the links to the extension itself; here is the documentation on saving using the GridView
but there is a need to make changes to the two models, so I will transform the code like this in the controller
if (Yii::$app->request->post('hasEditable')) { $id = Yii::$app->request->post('editableKey'); $editableAttribute= Yii::$app->request->post('editableAttribute'); $model = Transliter::findOne($id); $out = Json::encode(['output'=>'', 'message'=>'']); $posted = current($_POST['Transliter']); $post = ['Transliter' => $posted]; if ($model->load($post)) { $model->$editableAttribute=$posted; if($model->save()){}else{ return var_dump($model->getErrors()); } $output = ''; $out = Json::encode(['output'=>$output, 'message'=>'']); } echo $out; return; I get the error Internal Server Error and if you comment on the save and return the model like this
if (Yii::$app->request->post('hasEditable')) { $id = Yii::$app->request->post('editableKey'); $editableAttribute= Yii::$app->request->post('editableAttribute'); $model = Transliter::findOne($id); $out = Json::encode(['output'=>'', 'message'=>'']); $posted = current($_POST['Transliter']); $post = ['Transliter' => $posted]; if ($model->load($post)) { $model->$editableAttribute=$posted; } echo $out; return var_dump($model->category); I get that there is a change but not saved. Debag gives an error
yii\base\ErrorException: Undefined offset: 0 in /var/www/film.lc/vendor/yiisoft/yii2/db/Command.php:330 Stack trace: #0 /var/www/film.lc/vendor/yiisoft/yii2/db/ActiveRecord.php(225): yii\db\Command->update() #1 /var/www/film.lc/vendor/yiisoft/yii2/db/BaseActiveRecord.php(765): yii\db\ActiveRecord::updateAll() #2 /var/www/film.lc/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\db\BaseActiveRecord->updateInternal() #3 /var/www/film.lc/vendor/yiisoft/yii2/db/BaseActiveRecord.php(636): yii\db\ActiveRecord->update() #4 /var/www/film.lc/backend/modules/transliter/controllers/TransliterController.php(50): yii\db\BaseActiveRecord->save() #5 /var/www/film.lc/vendor/yiisoft/yii2/base/InlineAction.php(57): backend\modules\transliter\controllers\TransliterController->actionIndex() #6 /var/www/film.lc/vendor/yiisoft/yii2/base/InlineAction.php(57): ::call_user_func_array:{/var/www/film.lc/vendor/yiisoft/yii2/base/InlineAction.php:57}() #7 /var/www/film.lc/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams() #8 /var/www/film.lc/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction() #9 /var/www/film.lc/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction() #10 /var/www/film.lc/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest() #11 /var/www/film.lc/backend/web/index.php(18): yii\base\Application->run() #12 {main}