i have develop one test Application this application use JS Control ejGrid this grid i use to Add,Update,Delete Operation but i face issues to Update data for checking validation rules .Add Data time Validation is perfect work but Update Record time not Check Validation Rule.
i have use render ejGrid using Templete funcation.
$(element).find('#Grid').ejGrid({
allowPaging: false,
allowSorting: true,
allowGrouping: false,
allowFiltering: true,
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
showDeleteConfirmDialog: true,
titleColumn: "ZoneName",
editMode: "dialogtemplate",
dialogEditorTemplateID: "#template"
},
enableDropAreaAnimation: true,
scrollSettings: { width: '100%', height: 300 },
filterSettings: { filterType: "excel" },
dataSource: ej.DataManager({
url: ServiceURI + "api/Zone",
adaptor: "WebApiAdaptor",
crossDomain: true
}),
toolbarSettings: {
showToolbar: true,
toolbarItems: [
ej.Grid.ToolBarItems.Search,
ej.Grid.ToolBarItems.Add,
ej.Grid.ToolBarItems.Edit,
ej.Grid.ToolBarItems.Delete,
ej.Grid.ToolBarItems.Update,
ej.Grid.ToolBarItems.Cancel
]
},
allowScrolling: true,
groupSettings: {
showToggleButton: true,
showUngroupButton: true
},
isResponsive: true,
enableResponsiveRow: true,
columns: [
{ field: "ZoneID", isPrimaryKey: true, visible: false, headerText: "ZoneID" },
{
field: "ZoneName",
headerText: "Zone",
validationRules: { required: true,message:"required" },
validationMessage: { required: "Required" }
},
{ field: "ServerID", headerText: "Server", editType: ej.Grid.EditingType.Dropdown }
],
toolbarClick: function (e) {
},
actionComplete: function (args) {
console.log(args);
if (args.requestType == "save" || args.requestType == "delete") {
var gridObj = $("#Grid").ejGrid("instance");
gridObj.refreshContent();
}
if (args.requestType == "beginedit") {
$("#ServerID").ejDropDownList({
dataSource: scope.ServerList,
text: args.rowData.ServerID
});
var gridObj = $("#Grid").data("ejGrid");
console.log(gridObj.editFormValidate());
}
if (args.requestType == "add") {
$("#ZoneID").prop("disabled", true);
$("#ServerID").ejDropDownList({
dataSource: scope.ServerList,
text: args.rowData.ServerID
});
}
},
actionBegin: function (args) {
//console.log(args.requestType);
console.log(args);
}
});