使用 DHTMLX Pro,我尝试将行添加到我的表中。 header 部分加载正常,但其他行未加载到表中。这是我的代码,
使用 Require.js 包含
'dhtmlxcommon',
'dhtmlxgrid',
'dhtmlxgridcell'
我的渲染函数加载 GridView 如下:
render: function(){
var self = this;
this.mygrid = new dhtmlXGridObject('grid-layout');
this.mygrid.setImagePath('../dhtmlx/imgs/');
this.mygrid.setHeader("ID,Name,Format");
this.mygrid.setColAlign("center","center","center");
this.mygrid.setSkin('dhx_skyblue');
this.mygrid.init();
data={
rows:[
{ id:1, data: ["Foo", "Gates", "100"]},
{ id:2, data: ["Bar", "Tom", "1000"]},
{ id:3, data: ["Rain", "Henry", "-200"]}
]
};
//var newId = (new Date()).valueOf();
//this.mygrid.addRow(newId,"1,2,3,4,5,6,7,8"); // This does not add a row
this.mygrid.parse(data,"json"); // This does not add a row either
},
不确定为什么不使用 addRow
或 mygrid.parse
添加表行。
最佳答案
代码看起来正确。检查“网格布局”容器的大小。它必须有一些非零高度,否则网格的数据部分将不会显示。
关于javascript - DHTMLX 网格中缺少行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27934405/