我想将 JsArray 与 Webix 组件 DataTable 一起使用。但我有一个问题。当我使用 JsArray 格式时,我无法更新 Webix 数据网格中的数据。不幸的是,我只能看到它的数据的开头。检查示例以了解问题:
var array1 = [ [1,"Marie","Oslo"],[2,"John","Los Angeles"],[3,"Kate","London"] ];
var array2 = [ [4,"Martin","Manchester"],[5,"Joana","Lisbon"],[6,"Ronaldo","Barcelona"],[7,"Matthew","Portland"] ];
webix.ui({
view:"button",
label:"test new data",
click: function() {
new_data()
}
});
webix.ui({
view:"datatable",
id: "mytable",
columns:[
{id:"data0", header:"ID" },
{id:"data1", header:"Name" },
{id:"data2", header:"City" }
],
datatype: "jsarray",
data: array1
});
function new_data () {
var mytable = $$("mytable");
mytable.parse(array2);
}
按下“测试新数据”按钮后,表格中出现 4 个新的空行。