Fastadmin後臺列表點擊文字彈窗顯示鏈接內容

具體需求:

點擊列表裏面的用戶名.顯示用戶詳細信息

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']);

最終效果:

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章