Search code examples
javascriptjqueryjqgrid

how can i make exception on jqgrid multiselection?


jQuery("#grid").jqGrid({
    datatype: "local",
    width:'auto',
    height: 'auto',     
    multiselect:true,
    colNames:[
        'no'
    ],
    colModel:[
        {name:'no', align:'right', width:70}
    ],  
    beforeSelectRow: function(rowid, e) {
        if($("#grid>tbody tr").eq(rowid).children().eq(3).text()=="unused"){                
            return true;
        }else{
            return false;
        }
    }
    loadComplete: function(data) {          
        $("#grid").parents('div.ui-jqgrid-bdiv').css("max-height","250px");
    },
}); 

enter image description here

enter image description here

i don't want to select skyblue part.

so i removed its checkbox.

but when i select all, even skyblue part doesn't have checkbox, it's still selected.

how can i solve this problem?


Solution

  • If you add a disabled class to this row, it will be not selected either with user input and when you click SelectAll - in this case you do not need to remove the check box.

    If you use jQuery UI css the class is named ui-state-disabled

    If You use Bootstrap 3,4,5 the class is named ui-disabled