如何在dgrid中插入新列?
我的代码:
window.grid = new DataGrid({bufferRows: Infinity}, "gridResultsDiv");
for (var i = 0; i < layoutFields.length; i++) {
var newColumn = [{ field: layoutFields[i].field, name: layoutFields[i].name }];
grid.set("columns", newColumn);
}
但是我的数组layoutFields
的最后一列仍然存在。
我做错了什么?
答案 0 :(得分:0)
我编写了这段代码,现在显示了所有列:
grid = new (declare([DataGrid, Selection]))({
bufferRows: Infinity,
columns: layoutFields, // layoutFields is my array with fields and labels.
selectionMode: "single"
}, "gridRresultsDiv");
var memStore = new Memory({ data: data });
grid.set("store", memStore);
grid.startup();
TKS