我正在使用 jqwidgets 的 Jqxgrid。
我在网格中做了一个下拉列表。
我想在页面加载时默认以可编辑模式显示下拉列表。
请看一下这个屏幕截图,其中第一个下拉菜单显示为“请选择”,它是点击网格单元格,默认如何绑定它。
下面是代码。
{
text: 'Position of meter in Rack', datafield: 'MeterPositionInRack', width: 180, columntype: 'dropdownlist', editable: true,
createeditor: function (row, column, editor) {
var list = ['1', '2', '3' ,'4'];
editor.jqxDropDownList({ autoDropDownHeight: true, source: list, selectedIndex: 0 });
editor.jqxDropDownList.bind('select', function (event) {
var args = event.args;
var item = $('#jqxdropdownlist').jqxDropDownList('getItem', args.index);
alert('Selected: ' + item.label);
});
}
, initeditor: function (row, cellvalue, editor) {
var list1 = ['1', '2', '3', '4'];
console.log("initeditor: " + list1);
editor.jqxDropDownList({ autoDropDownHeight: true, source: list1, selectedIndex: 0 });
}
}
请帮我。