PDA

View Full Version : disable checkboxModel



chandan.behura
16 Sep 2012, 3:47 AM
Hi.,
How to Make disable the check values in a checkBoxModel after checking the 'all check'.

I mean after checking all check check box the checked values should disable.

metalinspired
16 Sep 2012, 11:01 PM
add an listener to change event with simple loop that will traverse trough all your buttons in that group and disable them.

chandan.behura
18 Sep 2012, 7:07 AM
add an listener to change event with simple loop that will traverse trough all your buttons in that group and disable them.
Hi,
I have done for the default all selection for the Model for 'show' event of the window containing the checkBoxModel .bellow is my code.


onShowSC : function() {
var store = this.getShippingConditionStoreStore();
max = store.getCount();
var view = Ext.getCmp('sccheckgridId');
var model = view.getSelectionModel();
var allSelection = [];
store.queryBy(function(record) {
allSelection.push(record);

});
model.select(allSelection);


But unable to do disable the model for all selection and and again enable by unchecking the 'All' check one.

metalinspired
18 Sep 2012, 10:05 AM
How about this:



onShowSC : function() {
// Get selection model
var sm = Ext.getCmp('sccheckgridId').getSelectionModel();
// Tell selection model to select all records and to suppress any select event
sm.selectAll(true);
// Lock selection
sm.setLocked(true);
}

Naveen S
6 Apr 2016, 7:22 PM
You can use beforedeselect event to not to allow him to deselect the row(s). listeners{ beforedeselect: function(th,rec){ // Based on your logic you can allow deselecting whichever row you want. // When you return false checkbox wont be unchecked. (Fired before a record is deselected. If any listener returns false, the deselection is cancelled) return false; } }

Naveen S
6 Apr 2016, 7:25 PM
You can use beforedeselect event to not to allow him to deselect the row(s).

listeners{
beforedeselect: function(th,rec){
// Based on your logic you can allow deselecting whichever row you want.


// When you return false checkbox wont be unchecked. (Fired before a record is deselected. If any listener returns false, the deselection is cancelled)



return false;

}

}