有一个自定义按钮类(从Encore\Admin\Actions\RowAction 扩展)。
该类有一个确认窗口,其中包含每行的唯一信息。
/ **
* @return void
* /
public function dialog()
{
$model = Categories::where('id',$this->getKey())->with('users')->get();
$this->question(trans('admin.delete_confirm'), 'Comment:'.$model[0]->comment, ['confirmButtonColor' => '#d33']);
}
当脚本形成调用对话框时,它们具有相同的类标识符(例如,“. grid-row-action-5dca9548c28226038 ”),但文本不同。
...
$ ('.grid-row-action-5dca9548c28226038').off('click').on('click', function() {
...
"text": "Comment: text 1",
...
}
$ ('.grid-row-action-5dca9548c28226038').off('click').on('click', function() {
...
"text": "Comment: text 2",
...
}
$ ('.grid-row-action-5dca9548c28226038').off('click').on('click', function() {
...
"text": "Comment: text 3",
...
}
...
如何让 Laravel 管理员为每一行生成一个唯一标识符?