-
18 May 2012 10:12 AM #1
Problem with CheckboxSelectionModel and listener on store.
Problem with CheckboxSelectionModel and listener on store.
Hi, I have checked trouble to write the rows of a grid that has a selModel = CheckboxSelectionModel. I attached my code. The strange thing is that I work loading the event but the rows are not checked. I appreciate any help.
Code:var checkBox = new Ext.grid.CheckboxSelectionModel(); checkBox.on('rowselect', function(a,rowIndex,record){ var layer = map.getLayersByName("mob_"+record.get('id').toString()); layer[0].setVisibility(true); },this); var grid = new Ext.grid.GridPanel({ title : 'Lista de Móviles', store : store, border : false, autoScroll : true, stripeRows : true, loadMask : false, stateful : true, id : 'gridMovil', name : 'gridMovil', region : 'center', selModel : checkBox, columns : colModel.columns }); Ext.getCmp('gridMovil').getStore().on('load', function(store, opt){ Ext.getCmp('gridMovil').getSelectionModel().selectAll(); }); Ext.getCmp('gridMovil').getStore().loadData(respuesta.movil);
-
21 May 2012 3:17 AM #2
debug firing events
debug firing events
Hi mtobar
Did you check whether 'load' and 'rowselect' events are firing or not? Also If you provide store and colmodel I can understand your problem well.Below code is basic example that works fine
Code:
var selModel = new Ext.grid.CheckboxSelectionModel({
listeners: {
rowselect: function () {
alert('rowselect')
}
}
})
var grid = new Ext.grid.GridPanel({
renderTo: Ext.getBody()
, store: {
xtype: 'jsonstore'
, root: 'item'
, fields: ['x']
}
, colModel: new Ext.grid.ColumnModel({
columns: [
selModel,
{ header: 'a', dataIndex: 'x' }
]
})
, selModel: selModel
})
grid.getStore().on('load', function () { grid.getSelectionModel().selectAll(); })
grid.getStore().loadData({ item: [{ x: 'asd'}] });sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.


Reply With Quote