[Grid]
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true" >
<e-grid-pagesettings pageCount="5"></e-grid-pagesettings>
<e-grid-columns>
. . .
<e-grid-column field="ShipCountry" headerText="Ship Country" edit="@( new { create = "create", write = "write", read = "read", destroy = "destroy" })"></e-grid-column>
</e-grid-columns>
</ejs-grid>
[template code]
<script>
function create() {
elem = document.createElement('input'); // create a input element
return elem;
}
function destroy(args){
autocomp.destroy();
}
function read(args) {
return autocomp.value;
}
function write(args) {
autocomp = new ej.dropdowns.AutoComplete({
dataSource: @Html.Raw(Json.Encode(@ViewBag.data)),//assign a new DataSource
// map the appropriate columns to fields property
fields: { value: 'Country' },
//enable the search operation for Dropdown
allowFiltering: true,
placeholder: "Select a Country",
value: args.rowData.Country
})//selected data
autocomp.appendTo(elem);
}
</script> |