$("#grid1").igGrid({ virtualization: false, autoGenerateColumns: false, autofitColumns :true, primaryKey: "LicenseKey", caption: licenseCaption, renderCheckboxes: true, // note: if primaryKey is set and data in primary column contains numbers, // then the dataType: "number" is required, otherwise, dataSource may misbehave columns: [{ headerText: licenseKeyHeader, key: "LicenseKey", width: "320px" }, { headerText: assetNameHeader, key: "AssetName", width: "120px" }, { headerText: macIdHeader, key: "MacId", width: "140px" }, { headerText: logicTypeIdHeader, key: "LogicTypeId", width: "110px", formatter: lookupLogicTypeName }, { headerText: subOrgIdHeader, key: "SubOrgId", width: "100px", formatter: lookupSubOrgName }, { headerText: driverIdHeader, key: "DriverId", width: "110px", dataType: "bool" }, { headerText: communicatorHeader, key: "Communicator", width: "110px", dataType: "bool" }, { headerText: premiumMappingHeader, key: "PremiumMapping", width: "110px", dataType: "bool" }, { headerText: daysLeftHeader, key: "DaysLeft", width: "95px" } ], dataSource: deviceLicenses, aggregateTransactions: true, height: "600px", width: "100%", tabIndex: 1, features: [{ name: "Sorting", type: "local" }, { name: "RowSelectors", enableCheckBoxes: true, enableRowNumbering: true }, { name: "Selection", mode: "row", multipleSelection: true }, { name: "Updating", enableAddRow: false, editMode: "row", enableDeleteRow: false, editCellStarting: function (evt, ui) { //Disabling Columns based on the value of DaysLeft column var daysLeft = ui.owner.grid.getCellValue(ui.rowID, "DaysLeft"); if (daysLeft != null) { if (ui.columnKey == "MacId") { return false; } else if (ui.columnKey == "DriverId" || ui.columnKey == "Communicator" || ui.columnKey == "PremiumMapping") { //If DaysLeft is not blank feature can be added but cannot be removed var currRow = ui.owner.grid.findRecordByKey(ui.rowID); if (ui.columnKey == "DriverId") if (currRow.DriverId == true) return false; if (ui.columnKey == "Communicator") if (currRow.Communicator == true) return false; if (ui.columnKey == "PremiumMapping") if (currRow.PremiumMapping == true) return false; } } }, rowAdded: function (evt, ui) { $("#undo").igButton("option", "disabled", false); $("#saveChanges").igButton("option", "disabled", false); }, rowDeleted: function (evt, ui) { $("#undo").igButton("option", "disabled", false); $("#saveChanges").igButton("option", "disabled", false); }, editRowEnded: function (evt, ui) { if (ui.update) { $("#undo").igButton("option", "disabled", false); $("#saveChanges").igButton("option", "disabled", false); } }, columnSettings: [{ columnKey: "LicenseKey", readOnly: true }, { columnKey: "AssetName", required: true, editorOptions: { maxLength: 64 } }, { columnKey: "MacId", required: true, editorOptions: { type: "mask", inputMask: "AA\:AA\:AA\:AA\:AA\:AA" } }, { columnKey: "LogicTypeId", required: true, editorType: "combo", editorOptions: { dataSource: logicTypes, textKey: "Name", valueKey: "Id" } }, { columnKey: "SubOrgId", required: true, editorType: "combo", editorOptions: { dataSource: subOrgs, textKey: "Name", valueKey: "Id" } }, { columnKey: "DriverId" }, { columnKey: "Communicator" }, { columnKey: "PremiumMapping" }, { columnKey: "DaysLeft", readOnly: true } ] }] })