samedi 23 janvier 2016

jQgrid: Disable checkbox click and select checkbox only when checkbox is clicked

I am using jqgrid using multiselect option. There are two different functionality that I have to implement. 
Functionality 1: 
I have to disable check checkbox depends upon some condition. For that I am using below block of code in beforrowselect event.

beforeSelectRow: function(rowid, e) {
    if( $("#jqg_TableId_"+rowid).attr("disabled") ){
        return false;
    }
    return true; 
}

The functionality is working fine with this block of code.

Functionality 2: But issue is when I click on anywhere in the row, the checkbox get selected but the checkbox value is not coming out correct. The value of checkbox is accurate when I click inside the area of checkbox. For that I want to restrict the user to click exactly on checkbox area to get checkbox clicked. For that I am using below mentioned block of code.

beforeSelectRow: function(rowid, e) { 
   return $(e.target).is('input[type=checkbox]');
},

If I am using any one block alone then its working fine for that functionality.
I need to implement both the functionality but both the block returning value. It is not possible to return value for both the condition. Please help me out How can I implement both the functionality.

Below is the complete code that I have to implement.
beforeSelectRow: function(rowid, e) { if( $("#jqg_TableId_"+rowid).attr("disabled") ){ return false; } return true; } return $(e.target).is('input[type=checkbox]'); },




Aucun commentaire:

Enregistrer un commentaire