Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anybody help me in disabling checkbox in jqgrid based on some conditions in load complete event.
Posted

On load Compelete,

var gridItems= [];
gridItems= $("#tblCountries").jqGrid('getRowData');

for (var i = 0; i < gridItems.length; i++) {
if (gridItems[i].CountryActive.toLowerCase() == "yes") {
$('#tblCountries tr:eq(' + gridItems[i].i + ') td:eq(' + getColumnSrcIndexByName($("#tblCountries "), 'chkActive') + ')').children().eq(0).attr('disabled', true);
}
}


var getColumnSrcIndexByName = function (grid, columnName) {
var cm = grid.jqGrid('getGridParam', 'colModel'),
i = 0, index = 0, l = cm.length, cmName;
while (i < l) {
cmName = cm[i].name;
i++;
if (cmName === columnName) {
return index;
} else if (cmName !== 'rn' && cmName !== 'cb' && cmName !== 'subgrid') {
index++;
}
}
return -1;
};
 
Share this answer
 
 
Share this answer
 
Comments
afzalkarani 23-Oct-14 0:37am    
This solution does not work with me. I tried it
Then just do a Google search. There are many solutions. Try one by one. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900