PDA

View Full Version : Confusion about rowselect



dotnetCarpenter
17 Apr 2007, 7:35 AM
Just a quick question:
I have two code snippets that to me is almost identical but one work and the second won't. I just don't see why not(!?). First the code snippet that won't work:


var rsm = new Ext.grid.RowSelectionModel({singleSelect:true});
rsm.on('rowselect', function(e, rownumber, row){
Ext.MessageBox.alert('row.data.eventID', row.data.eventID);
});
// create the grid
var grid = new Ext.grid.Grid('events-grid', {
ds: ds,
cm: cm,
selModel: rsm,
enableColLock:false,
loadMask: {msg: 'Henter events...', msgCls: 'gridMsg'}
}
and then the approach that works:

// create the grid
var grid = new Ext.grid.Grid('events-grid', {
ds: ds,
cm: cm,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
loadMask: {msg: 'Henter events...', msgCls: 'gridMsg'}
});
grid.getSelectionModel().on('rowselect', function(e, rownumber, row) {
Ext.MessageBox.alert('row.data.eventID', row.data.eventID);
});What gives?

dotnetCarpenter
30 Apr 2007, 2:07 AM
Still no one that knows?

kubens
30 Apr 2007, 3:01 AM
I am not sure, but in a similar case in which I switch the data source of an existing grid I recognized that it is sometimes necessary to ensure that all grid internal bindings are correct. Means that it is sometimes insufficient just to set a property. Normally this should encapsulated by a setter method, but in my case there was not such a setter method :(

I know that this is not satisfactory, but at least a assumption

Br
Wolfgang