[index.js]
var elem;
var dObj;
var shipCountryData = ["Italy", "Mexico", "Ireland", "USA", "France", "Germany", "UK", "Finland", "Spain", "Sweden"];
var grid = new ej.grids.Grid({
dataSource: window.orderDataSource.splice(0, 20),
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal', newRowPosition: 'Top' },
allowPaging: true,
pageSettings: { pageSize: 5 },
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
columns: [
. . . . .
{
field: 'ShipCountry', headerText: 'Ship Country', width: 150,
edit: {
create: function () {
elem = document.createElement('input');
return elem;
},
read: function () {
return dObj.value;
},
destroy: function () {
dObj.destroy();
},
write: function (args) {
dObj = new ej.dropdowns.AutoComplete({
dataSource: shipCountryData,
value: args.rowData["ShipCountry"] ? args.rowData["ShipCountry"] : "",
});
dObj.appendTo(elem);
}
}
}
],
});
|