dropdown edit type selection to read mode for few records.
-
hi, I have a requirement in the jqgrid data that totally 3 columns in that one is name,date and one column called department where the edit type is select have two options education and humanresources. for some records like up to this month 10/31 the records should be editable , i mean we can select some thing and we can update. only the current month should be editable and next month data should not editable we can view it but not edit just like should be in read mode. How to approach this scenario? $("#grid").jqGrid({ url: 'Handler.ashx', datatype: 'json', height: 250, colNames: ['Name','Department', 'Date'], colModel: [ { name: 'Name', index: 'Name', width: 256, stype: 'text', editable: true, sortable: false, editoptions: { disabled: "disabled"} }, { name: 'Department', index: 'Department', width: 256, stype: 'text', sortable: false, editable: true, edittype: 'select', formatter: rowColorFormatter, editoptions: { value: "Education:Education; Humanresource:Humanresource" }}, { name: 'Date', index: 'Date', width: 256, editable: true, stype: 'text', sortable: true, sorttype: 'date', editoptions: { disabled: "disabled"} } ], rowNum: 100, loadonce: true, rowList: [100, 200, 300], pager: '#pager', sortname: 'name', viewrecords: true, sortorder: 'asc', gridview: true, ignoreCase: true, caseSensitive: false, rownumbers: true, reloadAfterSubmit: false, width: 1024, gridComplete: function() { for (var i = 0; i < rowsToColor.length; i++) { var Department = $("#" + rowsToColor[i]).find("td").eq(2).html(); if (Department == "Humanresource") { $("#" + rowsToColor[i]).find("td").css("background-color", "red"); } } }, jsonReader: { repeatitems: false }, caption: 'Department Update', editurl: 'Handler.ashx', onSelectRow: function(id) { if (id && id !== lastSelectedId) { $('#grid').restoreRow(lastSelectedId); $('#grid').editRow(id, true); lastSelectedId = id; } }, afterSubmit: function() { $(this).jqGrid("setGridParam", { datatype: 'json' }); return [true]; alert("returnvalue"); } }); function rowColorFormatter(cellValue, options, rowObject) { if (cellValue == "Humanresources") rowsToColor[rowsToColor.length] = options.rowId; return cellValue; }; $("#grid").setGridParam({ sortname: 'CalDate', sortorder: 'asc' }).trigger('reloadGrid'); $("#grid").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, search: true, searchtext: "Search", reloadAfterSubmit: true, cloneToTop: true, overlay: false, beforeRefresh: functio