gberg927
gberg927

Reputation: 1686

ExtJS CheckboxSelectionModel Listener

I would like to add a listener to a CheckboxSelectionModel when the checkbox (or select all checkbox) is clicked.

var smSensors = new xg.CheckboxSelectionModel();

How would I add this listener?

Thanks!

Upvotes: 2

Views: 3859

Answers (1)

RetroGhost
RetroGhost

Reputation: 970

You add a listener to the checkbox selection model as follows and do what ever is required when a row is selected.

var checkBoxSelMod = new Ext.grid.CheckboxSelectionModel( {
    listeners:{
        rowselect : function( selectionModel, rowIndex, record){
            var selectedRows = selectionModel.getSelections();
            if( selectedRows.length > 0){
                for( var i = 0; i 0){
                    for( var i = 0; i < selectedRows.length; i++) {
                        ; // Do whatever you want to do
                    }
                }
                // More code related to deselection of a chekbox
            }
        }
    }
});

Upvotes: 3

Related Questions