I am showing some data in jqgrid and I am using the option “multiselect:true”.In the grid, for a specific row, I want the checkbox not to be show or if it is shown then it should be disabled.Can I do this??I am using jqgrid3.5.2.
Thanks in advance.
I am showing some data in jqgrid and I am using the option “multiselect:true”.In the grid, for a specific row, I want the checkbox not to be show or if it is shown then it should be disabled.Can I do this??I am using jqgrid3.5.2.
Thanks in advance.
Try this:
loadComplete: function() {
var ids =jQuery("#TableId").jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
var rowId = ids[i];
var Status = jQuery("#TableId").jqGrid('getCell',ids[i],'Status');
if(condition matches){
jQuery("#jqg_TableId_"+rowId).attr("disabled", true);
}
}
}
To avoid row selection on click anywhere on disabled row:
beforeSelectRow: function(rowid, e) {
if( $("#jqg_TableId_"+rowid).attr("disabled") ){
return false;
}
return true;
}
Simply hide the combo box column with the "hideCol" method :
$("#mygridSelector").jqGrid({
//myGridOptions...
}).hideCol('cb');
this code is working fine in my application please try your self..
below code is very simple and well understandable
gridComplete: function() //when first time load data
{
if(consignNo != "") //this is my condition when my check box is disable when load data
{
$("#jqg_batchList_" + ids[i]).attr("disabled", true);
}
},
beforeSelectRow: function(rowid, e) //this function is used when you select rows
{
//means when your check box is disabled,you can't check your check box
if( $("#jqg_batchList_"+rowid).attr("disabled") )
{
return false;
}
return true;
},
onSelectAll: function(aRowids,status) // this function is used when you select all check box
{
if (status)
{
for(var i=0;i<aRowids.length;i++)
{
if( $("#jqg_batchList_"+aRowids[i]).attr("disabled"))
{
$("#jqg_batchList_" + aRowids[i]).removeAttr("checked");
}
}
}
},
//added by Najarhasan hasnutech@gmail.com just copy code and put your jqgrid code
Every checkbox has uniquie id which is combination of
“jqg_”+rowid – where the rowid is the id of the row.
You can use the following code to make it invisible
$("#jqg_Q391")..css("visibility", "hidden");