具体需求:
点击列表里面的用户名.显示用户详细信息
js:
{
field: 'customer.nickname',
width: "120px",
title: __('Customer.nickname'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'detail',
text:function (row) {
return row.customer.nickname
},
title:function (row) {
return row.customer.nickname
},
classname: 'btn-dialog',
url: function (row) {
return '/hVvsKEQZnx.php/customer/edit/ids/'+row.customer.id
}
}
],
formatter: Table.api.formatter.buttons,
operate: "LIKE"
},
注意点:
控制器里面一定要显示用户的ID,否则链接会出错
$row->visible(['customer']);
$row->getRelation('customer')->visible(['nickname', 'id']);
最终效果: