|
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" created="created" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true" height="300">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-columns>
. . .
<e-grid-column field="ShipCountry" headerText="ShipCountry " width="110">
</e-grid-column>
<e-grid-column field="ShipCity" width="110">
</e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
. . .
function created(args) {
this.getColumns()[2].edit = {
create: function () {
countryElem = document.createElement('input');
return countryElem;
},
read: function () {
return countryObj.text;
},
destroy: function () {
countryObj.destroy();
},
write: function () {
countryObj = new ej.dropdowns.DropDownList({
. . .
});
countryObj.appendTo(countryElem);
}
};
this.getColumns()[3].edit = {
create: function () {
stateElem = document.createElement('input');
return stateElem;
},
read: function () {
return stateObj.text;
},
destroy: function () {
stateObj.destroy();
},
write: function () {
stateObj = new ej.dropdowns.DropDownList({
. . .
});
stateObj.appendTo(stateElem);
}
}
}
</script> |