...
var dropDownData = [
{ sid: '1', sname: 'France' },
...
];
var grid = new ej.grids.Grid({
dataSource: window.orderData,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Batch' },
allowPaging: true,
pageSettings: { pageCount: 5 },
toolbar: ['Add', 'Delete', 'Update', 'Cancel'],
columns: [
...
{
field: 'ShipCountry', headerText: 'Ship Country', edit: {
create: function () {
elem = document.createElement('input');
return elem;
},
read: function () {
return dropDownObj.value;
},
destroy: function () {
dropDownObj.destroy();
},
write: function (args) {
dropDownObj = new ej.dropdowns.DropDownList({
dataSource: dropDownData,
fields: { text: 'sname', value: 'sname' },
value: args.rowData[args.column.field],
popupHeight: '230px',
allowFiltering: true,
});
dropDownObj.appendTo(elem);
}
}, width: 150
}
],
});
grid.appendTo('#Grid'); |