我正在尝试修改w2ui网格的可编辑字段中的组合框所附加的"items“数组,在网格被初始渲染之后。
为了演示我的问题,我在这里设置了一个取自“网格内联编辑”演示的jsfiddle:
http://jsfiddle.net/8dkdoc4p/5/
既然出现了一些框,告诉我必须包含代码(为什么?)从概念上讲,这是我想要做的。请注意,除非您看过这个网格演示:http://w2ui.com/web/demos/#!grid/grid-21,否则这不会有太大意义
function alterComboBox() {
people.push({ id: myid, text: "ID " + myid});
myid++;
w2ui['grid'].refresh();
}这个想法是在运行时为组合框添加另一个项目,并让网格实际将新项目显示为另一个选项。
提前感谢!
发布于 2016-02-18 21:56:08
更改记录后,必须将全局记录"people“重新分配给w2ui网格列。
对于"select“字段,还必须调用render()方法。
http://jsfiddle.net/8dkdoc4p/8/
var myid = 22;
function alterComboBox() {
people.push({ id: myid, text: "ID " + myid});
myid++;
w2ui['grid'].getColumn('list').editable.items = people;
w2ui['grid'].getColumn('combo').editable.items = people;
w2ui['grid'].getColumn('select').editable.items = people;
w2ui['grid'].getColumn('select').render();
//w2ui['grid'].refresh(); // no need!
}https://stackoverflow.com/questions/35444684
复制相似问题