加载完成后就是出现这种错位现象,但是只要调整一下就会全部对齐
行的宽度也设置了,但是无论宽度设置多少,头部数据的宽度总是会比内容数据的宽度宽一点
表格是采用的加载本地json文件的方式
html
<input id="cc" name="dept" value="01">
js代码
$('#cc').datagrid({
idField: 'location',
url: 'data.json',
columns: [
[
{ field: 'location', title: '位置', align: "center", width: 120, rowspan: 2 },
{ title: '类别', halign: "center", colspan: 6 },
{ field: 'year', title: '统计年份', align: "center", width: 120, rowspan: 2 },
],[
{ field: 'warnning', title: '警示桩(根)', align: "center", width: 120, },
{ field: 'cover', title: '水泥盖板(个)', align: "center", width: 120, },
{ field: 'sign', title: '标志牌(个)', align: "center", width: 120, },
{ field: 'pillar', title: '立柱(根)', align: "center", width: 120, },
{ field: 'net', title: '铁丝网(平方米)', align: "center", width: 120, },
{ field: 'stone', title: '路缘石(米)', align: "center", width: 120, },
]
],
});
json
{"rows":[
{"location":"k3467-K3468", "warnning":"20", "cover":"13", "sign":"24", "pillar":"15", "net":"667", "stone":"3000", "year":"2016-3"},
{"location":"k3468-K3469", "warnning":"12", "cover":"23", "sign":"34", "pillar":"45", "net":"467", "stone":"5000", "year":"2015-3"},
{"location":"k3470-K3471", "warnning":"54", "cover":"34", "sign":"56", "pillar":"76", "net":"657", "stone":"3000", "year":"2015-7"},
{"location":"k3475-K3476", "warnning":"23", "cover":"53", "sign":"264", "pillar":"165", "net":"467", "stone":"5600", "year":"2016-3"}
]
}