Closed thanhnambkhn closed 5 years ago
You must be declare manual url in action column like this 'view' => function ($url, $model, $key) { return Html::a('', Url::to(["account/view",'id'=>$model['ta_id']])); }, 'update' => function ($url, $model, $key) { return Html::a('', Url::to(["account/update",'id'=>$model['ta_id']])); }, 'delete' => function ($url, $model, $key) { return Html::a('', Url::to(["account/delete",'id'=>$model['ta_id']])); }, 'add' => function ($url, $model, $key) { if ($model['ta_level'] !=3) { return Html::a('', $url."&level=".$model['ta_level']); } },
I released new version to solve this problem
Hi, I setup such as for my TreeGrid:
But I found that, the ID on {update} and {delete} url was wrong, such as: the row model ID is 10, but the url for updating is "update?id=9". I temporary fix that issue by add urlCreator to ActionColumn:
'urlCreator' => function ($action, $model, $key, $index) { if ($action === 'update') { $url = yii\helpers\Url::to(['update', 'id' => $model->id]); return $url; } if ($action === 'delete') { $url = yii\helpers\Url::to(['delete', 'id' => $model->id]); return $url; } }