PDA

View Full Version : wanted to disable single row of checkboxmodel in grid with keeping previous selection



vijay30487
31 Aug 2015, 10:42 AM
Hi Champs,

I am using selModel with checkboxmodel but after rendering all checkbox few checkbox I wanted to disable based on some condition.

I found setLocked() method on checkboxmodel, but is locking all checkbox not single row and it is deselect the eisting checkboxes as well!



selModel: {
type: 'checkboxmodel',
mode: 'MULTI',
checkOnly: true,
showHeaderCheckbox: false
}

Please suggest any pointer.
Thanks,
Vijay Gohil

jdkhamba
1 Sep 2015, 4:14 AM
One way would be to cancel the beforeselect event for those rows that qualify as being disabled based on your business logic. Something like this :


listeners:{
beforeselect:function(selModel,record,index){
// if record falls under the disabled list , cancel the event
// for example , if it is the first row, don't allow selection.

if(index == 0)
return false;

}
}


It probably does not exactly "disable" the row but it appears to do so :) . You could probably add some class to signify that it is disabled.

vijay30487
1 Sep 2015, 5:25 AM
Thanks a lot @jdkhanba, it works for me..