PDA

View Full Version : GRID - getSelectionModel().getSelection with remoteSort: true



odiico
16 Aug 2013, 10:42 AM
Hi,

The getSelection() function on the grid is returning a wrong record (not the selected one). This happens when the grid view is set to "grouped" and the store is configured with remoteSort: true. Changing the store to remoteSort:false corrects the behavior;


Code:


store = Ext.create('Ext.data.JsonStore', {
autoLoad: true,
proxy: {
type: 'ajax',
url: '/list.json',
reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
},
remoteSort: true,
sorters: [{
property: 'Name',
direction: 'ASC'
}],
pageSize: 20,
fields: ['Protocolo', 'Name']
});


grid = Ext.create('Ext.grid.Panel', {
frame: true,
title: 'Sponsored Projects',
renderTo: document.body,
store: store,
selModel: Ext.create('Ext.selection.CheckboxModel'),
features: [Ext.create('Ext.grid.feature.GroupingSummary')],
columns: [{
text: 'Protocolo',
flex: 1,
sortable: true,
dataIndex: 'Protocolo'
}, {
text: 'Name',
dataIndex: 'Name',
flex: 1,
sortable: true
}]
});




var Protocolo = grid.getSelectionModel().getSelection()[0].get('Protocolo')


The problem only happens when the grid is grouped by a field and the grid has multiple pages.

Gary Schlosberg
20 Aug 2013, 9:39 AM
I'm not able to reproduce this, but it sounds like a bug. Can you include a sample of the data you are using?