传入数据表行的位置
Position of the incoming datatable rows
正在尝试将数据从内联数据源加载到数据表的顶部。
pos
属性 适用于除上述位置之外的所有位置。
例如,
var data = [{title:1},{title:2}]
webix.ui({
view:"datatable", id:"table", autoConfig:true, data:grid_data
});
$$("table").parse({data:data, pos:0}) // should be the first
应该将数据添加到顶部,但它出现在数据表的底部。 pos
的任何其他值都将正常工作。所以我有点困惑 - 我做错了什么还是有其他方法可以做到这一点?
不确定为什么会发生这种情况,但作为另一种解决方案,您可以通过数据集迭代 add
方法。我也调查了一下,使用 table 的 blockEvent
方法可以避免多次重新渲染(add
触发器也 refresh
以显示添加的元素)。 s 数据存储:
$$("table").data.blockEvent(); // table.data gives access to the table's datastore
for ( var i = 0; i<3; i++)
$$("table").add(data[i], i);
$$("table").data.unblockEvent();
$$("table").refresh();
正在尝试将数据从内联数据源加载到数据表的顶部。
pos
属性 适用于除上述位置之外的所有位置。
例如,
var data = [{title:1},{title:2}]
webix.ui({
view:"datatable", id:"table", autoConfig:true, data:grid_data
});
$$("table").parse({data:data, pos:0}) // should be the first
应该将数据添加到顶部,但它出现在数据表的底部。 pos
的任何其他值都将正常工作。所以我有点困惑 - 我做错了什么还是有其他方法可以做到这一点?
不确定为什么会发生这种情况,但作为另一种解决方案,您可以通过数据集迭代 add
方法。我也调查了一下,使用 table 的 blockEvent
方法可以避免多次重新渲染(add
触发器也 refresh
以显示添加的元素)。 s 数据存储:
$$("table").data.blockEvent(); // table.data gives access to the table's datastore
for ( var i = 0; i<3; i++)
$$("table").add(data[i], i);
$$("table").data.unblockEvent();
$$("table").refresh();