tabler.render时,在cols中添加多个数组,colspan=1(默认),造成多余列数据显示,下图:
设置 colGroup: true
table.render({
elem: '#test'
, cols: [[ //标题栏
{ title: '长度', width: 80, colGroup: true }
, { title: '数量', width: 80, colGroup: true }
, { title: '时间', width: 80, colGroup: true }
, { title: '电流', width: 80, colGroup: true }
], [ //标题栏
{ title: 'm', width: 80, colGroup: true }
, { title: '个', width: 80, colGroup: true }
, { title: 's', width: 80, colGroup: true }
, { title: 'mA', width: 80, colGroup: true }
], [ //标题栏
{ field: 'field1', title: 'm', width: 80 }
, { field: 'field2', title: '个', width: 80 }
, { field: 'field3', title: 's', width: 80 }
, { field: 'field4', title: 'mA', width: 80 }
]]
, data: [{
"field1": "1"
, "field2": "2"
, "field3": "3"
, "field4": "4"
}]
});