I'm using Jqxgrid of jqwidgets.
I have taken a dropdown list in a grid.
I want to show dropdown list in editable mode by default on page load.
please have a look this screen shot where first dropdown showing as 'Please Choose' , it's coming on click on grid cell , how to bind it default.
Below is the code.
{
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 });
}
}
Please help me.
Jqxgrid has ready
properties to do anything after the grid is initialized and the binding is complete, so you can trigger begin update method:
$("#jqxgrid").jqxGrid({
...
ready: function () {
$("#jqxgrid").jqxGrid('beginrowedit', 0);
},
...
});
See also: