正文
如何在easyui datagrid 中显示外键的值
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
1、需要在角色列表显示角色类别的值,而角色类别是外键,关联数据字典,明细见下图:
2、代码如下:
columns: [[
{ field: 'ck', checkbox: true, align: 'left', width: 20 },
{ field: 'RoleName', title: '角色名称', width: 80 },
{
field: 'Dictionary', title: '角色类别', width: 100,
formatter: function (value, row, index) {
return new Object(row["Dictionary"]).Name;
}
},
{
field: 'UpdateTime', title: '最后更新时间', width: 50, align: 'left',
formatter: function (value, row, index) {
var datetime = TimeObjectUtil.formatterDateTime(value); return datetime;
}
},
{ field: 'Description', title: '备注', width: 150 }, ]]