when i added a new record in ejgrid after selecting the different values in drodown template column after save click from edittoolbars same value is binding to dropdown columns.
var wotypelist = @Html.Raw(Json.Encode(Model.lstEquipment.SelectMany(a => a.WorkorderTypes).Where(t => t.Text != null).ToList()));
var WorkordertypeDS = [];
var lengt = wotypelist.length;
for (i = 0; i < lengt; i++)
{
var WoType = {
"text" : wotypelist[i].Text,
"value" : wotypelist[1].Value
};
WorkordertypeDS.push(WoType);
};
var categorylist = @Html.Raw(Json.Encode(Model.lstEquipment.SelectMany(a => a.categories).Where(c => c.Text != null).ToList()));
var categoryDS = [];
var lengt = categorylist.length;
for(i = 0; i < lengt; i++)
{
var caType = {
"text" : categorylist[i].Text,
"value" : categorylist[1].Value
};
categoryDS.push(caType);
};
$(function () {
$("#Equipmentgrid").ejGrid({
dataSource: @Html.Raw(Json.Encode(Model.lstEquipment)),
allowPaging: true,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
{ field: "SelectedWorkOrderType", headerText: "Work Order Type", editType: ej.Grid.EditingType.Dropdown,dataSource:WorkordertypeDS, foreignKeyField: "value", foreignKeyValue: "text", textAlign: ej.TextAlign.center, validationRules: { required: true, number: true }, width: 90 },
{ field: "SelectedCategory", headerText: "Category", editType: ej.Grid.EditingType.Dropdown,dataSource:categoryDS,foreignKeyField: "value", foreignKeyValue: "text", textAlign: ej.TextAlign.center, width: 90 },
{ field: "EquipmentLocation", headerText: 'Equipment Location', width: 150 },
{ field: "SerialNumber", headerText: 'Serial Number', width: 100 },
{ field: "CatalogID", headerText: 'Catalog ID', width: 90 },
{ field: "Model", headerText: 'Model', width: 90 }
]
});
});
//$("#sampleProperties").ejPropertiesPanel();
function onSelectionTypeChange(args) {
$("#Equipmentgrid").ejGrid("cancelEdit");
$("#Equipmentgrid").ejGrid("model.editSettings.rowPosition", args.selectedValue);
}