PDA

View Full Version : [CLOSED][3.1.1] CheckboxSelectionModel loses its listeners



erki
15 Feb 2010, 7:27 AM
Hi,

Ext version tested:

Ext 3.1.1


Adapter used:

ext


Browser versions tested against:

FF 3.6


Description:

CheckboxSelectionModel seems to lose its listeners when doing grid.colModel.setConfig(). RowSelectionModel works OK.
Is it bug, feature or am I doing something wrong?


Test Case:


Ext.onReady(function(){

function _onRowSelect ()
{
alert ("Click-click");
}

// sample static data for the store
var myData = [
['3m Co',71.72],
['Alcoa Inc',29.01]
];


// create the data store
var store = new Ext.data.ArrayStore({
fields: [
{name: 'company'},
{name: 'price', type: 'float'}
]
});

// manually load local data
store.loadData(myData);

var columns = [
{id:'company',header: 'Company', sortable: true, dataIndex: 'company'},
{header: 'Price', sortable: true, dataIndex: 'price'}
];

sm = new Ext.grid.CheckboxSelectionModel ();
columns.unshift(sm);

// add listener
sm.on("rowselect", _onRowSelect, this);

// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: columns,
height: 350,
width: 600,
title: 'Array Grid',
sm: sm
});

// listener exists
alert ("hasListener(): " + grid.selModel.hasListener ("rowselect"));

grid.colModel.setConfig (columns);

// listener does not exist anymore
alert ("hasListener(): " + grid.selModel.hasListener ("rowselect"));

// show the grid
var win = new Ext.Window({
layout: 'fit',
width: 300,
height: 200,
plain: true,
items: grid
});

win.show(this);

});

Jamie Avins
15 Feb 2010, 8:55 AM
This is by design, setConfig now destroys old configurations.