<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true" load="load" >
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="100"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="100"></e-grid-column>
<e-grid-column field="Freight" width="100" format="C5"></e-grid-column>
<e-grid-column field="Verified" headerText="Verified" width="100"></e-grid-column>
<e-grid-column field="OrderDate" headerText="Order Date" width="90" format="yMd"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
var dropDownData = [{ "Verified": "Y", "SNO": 1 }, { "Verified": "N", "SNO": 2 }];
function load(args) {
this.columns[3].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: "Verified", value: "Verified" },
value: args.rowData[args.column.field]
});
dropdownObj.appendTo(elem);
}
}
}
</script>
|