解决界面显示关联表数据属性
templet:’
{{d(这个d固定的).productCategory(哪个表).categoryId(哪个属性)}}
’
table.render({
elem: '#demo'
,height: 420
,url: '/pall' //数据接口
,title: '操作记录表'
,page: true //开启分页
,toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
,totalRow: false //开启合计行
,cols: [[ //表头
{type: 'checkbox', fixed: 'left' }
,{field: 'productId', title: '商品ID', width:80, sort: true, fixed: 'left'}
,{field: 'productName', title: '商品名', width: 90, sort: true, totalRow: true}
,{field: 'productPrice', title: '商品价格', width:80, sort: true}
,{field: 'productDescription', title: '商品描述', width:80, sort: true}
,{templet:'<div>{{d.productCategory.categoryId}}</div>',title: '分类ID', width: 200, }
,{title: '分类名', width:150,templet:'<div>{{d.productCategory.categoryName}}</div>'}
,{title: '分类编号', width:150,templet:'<div>{{d.productCategory.categoryNumber}}</div>'}
,{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo',}
]]
});