PDA

View Full Version : [NOREPRO] [4.0.7] 'sortchange' fired twice when clicking grid header



mankz
21 Oct 2011, 4:51 AM
is this the expected behavior? Open any grid sample:



grid.headerCt.on('sortchange', function() { console.log(arguments); });

mankz
9 Nov 2011, 9:35 PM
bump.

evant
13 Nov 2011, 3:37 AM
Can't reproduce this in either 4.0.7 or 4.1.



/*

This file is part of Ext JS 4

Copyright (c) 2011 Sencha Inc

Contact: http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.

*/
Ext.Loader.setConfig({enabled: true});

Ext.Loader.setPath('Ext.ux', '../ux/');

Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.util.*',
'Ext.ux.data.PagingMemoryProxy',
'Ext.toolbar.Paging',
'Ext.ux.SlidingPager'
]);

Ext.onReady(function(){

var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
['American Express Company',52.55,0.01,0.02,'9/1 12:00am']
];

// register model
Ext.define('Company', {
extend: 'Ext.data.Model',
idProperty: 'company',
fields: [
{name: 'company'}
]
});


// create the data store
var store = Ext.create('Ext.data.Store', {
model: 'Company',
remoteSort: true,
pageSize: 10,
proxy: {
type: 'pagingmemory',
data: myData,
reader: {
type: 'array'
}
}
});

// create the Grid
var grid = Ext.createWidget('gridpanel', {
store: store,
columns: [{
text: 'Company',
sortable: true,
dataIndex: 'company',
flex: 1
}],
height:320,
width:600,
bbar: Ext.create('Ext.PagingToolbar', {
pageSize: 10,
store: store,
displayInfo: true,
plugins: Ext.create('Ext.ux.SlidingPager', {})
})
});

grid.render('grid-example');

store.load();

grid.headerCt.on('sortchange', function(){
console.log('foo');
});
});

mankz
13 Nov 2011, 10:01 AM
I should've mentioned, click 2-3 different headers and you'll see dual logs each click. It's easily repeatable in 4.0.7.

yufulou
17 Mar 2013, 7:12 PM
you should set "remoteSort: true" in store