Grid
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowFiltering: true,
allowPaging: true,
pageSettings: { pageSize: 7 },
editSettings: { allowAdding: true, allowEditing: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: ["search", "add", "edit", "delete", "update", "cancel"] },
actionComplete: "actionComplete",
columns: [
{ field: "OrderID", headerText: "Order ID", isPrimaryKey: true, width: 80 },
{ field: "CustomerID", headerText: "Customer ID", allowEditing: false, width: 80 },
{ field: "EmployeeID", headerText: "Employee ID", width: 80, editType: "dropdownedit" },
{ field: "Freight", headerText: "Freight", width: 90, },
{ field: "OrderDate", headerText: "OrderDate", width: 90 },
{ field: "ShipName", headerText: "ShipName", width: 90 },
],
});
});
actionComplete
function actionComplete(args) {
if (args.requestType == 'add') {
var len = this.model.columns.length;
for (i = 0; i < len; i++) {
if (args.model.columns[i]["allowEditing"] == false)
$("#" + this._id + args.model.columns[i]["field"]).removeClass("e-disable").removeAttr("disabled");// Remvove the class and attribute for disabled column while adding the record
}
}
} |