PDA

View Full Version : Grid Filtering in 4.2.1 (upgrade breakage)



Joshua Pruitt
20 Mar 2014, 8:50 AM
Hi all. I have a grid filtering setup that works fine in ExtJS 4.1.1.1, but when I attempt to upgrade to 4.2.1.883, my grid filters no longer work, and I'm complete stumped as to why. :( I'd like to upgrade because 4.2.x is notably faster for us. I'm using an MVC setup, and attempting to access the grid's filters programattically. Perhaps someone here can help! Here's what I've got:



// The Filters
var listFilters = {
ftype: 'filters',
autoReload: true,
local: false,
encode: 'encode',
updateBuffer: 750,
filters: [
{ type: 'numeric', dataIndex: 'id' },
{ type: 'string', dataIndex: 'title' }
]
};

// The Columns
var listColumns = [
{
id: 'id',
text: 'ID',
dataIndex: 'id',
width: 150,
filterable: true,
filter: { type: 'numeric' }
},
{
id: 'title',
text: 'Title',
dataIndex: 'title',
width: 75,
filterable: true,
filter: { type: 'string' }
}
];

// The Grid
Ext.define('JP.view.asset.List', {
extend: 'Ext.grid.Panel',
alias: 'widget.assetlist',
id: 'grid',
store: 'Assets', // referenced from another js file, per MVC
layout: 'fit',
features: [ listFilters ], // filters referenced here
columns: listColumns, // columns referenced here
listeners: {
afterrender: function(grid) {
// This works in 4.1.1, does nothing in 4.2.1
grid.filters.createFilters();
// ^^ Cannot call method 'createFilters' of undefined
// :( :(
// Can no longer reference `grid.filters` externally either, e.g.,
// from Ext.tree
}
}
});


Any ideas?! I'm completely stumped here. :( grid.filters can no longer be accessed programatically, nor do they load up in the GUI anymore (from column drop-downs). Works fine in 4.1.x.

Thank you!!!

Joshua Pruitt
21 Mar 2014, 10:23 AM
Okay, I figured it out. I first removed a conflicting included javascript file that was being loaded in our HTML header. Then I move the `paths` property out of `Ext.Loader.setConfig()` and put it in `Ext.application`. And thirdly, apparently `createFilters()` is a private method in 4.2.1, so I removed my reference to it.

Between those three things, everything now works! So, I leave this here in case someone else has a similar problem.

Gary Schlosberg
21 Mar 2014, 10:36 AM
Glad to hear you've gotten to the bottom of it, and thanks for posting a follow-up for the community.