You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am really new to Yii2 and I want to understand how I can obtain the DB table key for the value modified. The controller action is receiving the post ok , but I only have the changed variable., not the DB key to modify. How do I do this?
Nick
The text was updated successfully, but these errors were encountered:
I don't know if you still need this answer, but I can share with you what I did.
In the column definition, I used a callable to build a url with parameters, like this: [ 'class' => EditableColumn::class, 'attribute' => 'name-of-attribute', 'url' => ['change'], 'editableOptions' => function($model, $key, $index ) : array { return ['url'=>'change?id=$model->key]; } ],
where key is the key-field of the model
Then your action needs to define a parameter like this:
public function actionChange($id)
and within the action you can retrieve the model and validate, change the value of the attribute, and save.
Hi,
I am really new to Yii2 and I want to understand how I can obtain the DB table key for the value modified. The controller action is receiving the post ok , but I only have the changed variable., not the DB key to modify. How do I do this?
Nick
The text was updated successfully, but these errors were encountered: