-
17 Jan 2012 1:10 PM #1
Set Filter at the time Grid is initialised
Set Filter at the time Grid is initialised
Hi guys,
I want to set some default filters (Ext.ux.grid.FiltersFeature) when my grid is created, so it's like default filters to the grid, user can change the filter after grid is created.
extjs.png
The problem is : Filters are not initialised until user click the trigger on the column, so I cannot set default values to the filter.
I tried to fireEvent on the column but it doesn't seem to help.
Is there any way I can set default filters ?
-
18 Jan 2012 5:41 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Have you tried to set filters on the store to see if the filter feature picks it up?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Jan 2012 6:24 AM #3
-
18 Jan 2012 6:32 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Jan 2012 8:08 AM #5
-
27 Feb 2012 10:41 AM #6
same problem
same problem
Hello,
I have same problem. I need to load window with grid which is already filtered. I had luck with setting filters - i have it set, but to make it work i need to add another filter, even my filters are already set. Also I cant read them with getFilters function. Seems like filters are not initialised until i go with mouse and click on filter menu. After this action, I can read getFilters function.
So its some bug ? Or how can I solve this problem ?
Also I need remote sort, remote filtering.
Thanks for ANY response.
BR,
Andy
-
20 Apr 2012 7:05 AM #7
Any follow-up on this one?
Any follow-up on this one?
Any progress on this one for 4.0.7?
On sorting, the header changes into bold, but the filter is not applied.
As a not-working default filter is a stopper for us, could we get some feedback or workaround?
Has it to do with the order in which the grid, the filter and the store are rendered?
Could we solve this with an onRender override? (How?)
Thanks,
Lod
-
20 Apr 2012 10:14 PM #8
same problem... still looking for working solution...
-
25 Apr 2012 3:18 AM #9
this does the job for me:
Code:progressStore.prefetch({ start : 0, limit : 99, callback : function() { progressStore.guaranteeRange(0, 49); // Apply Initial Filter for column with dataIndex 'name' and Initial value 'initValue' if (progressGrid.filters != null) { var gridFilters = progressGrid.filters; gridFilters.createFilters(); var filter = gridFilters.filters.get('name'); filter.setActive(true); var field = gridFilters.getFilter('name'); if (field != null) { field.setValue('initValue'); } gridFilters.updateColumnHeadings(); } } });
-
1 Feb 2013 2:22 PM #10
An old thread, I'm aware, but I'm flummoxed by this myself.
Regarding the mechanisms that are different for the store's filter versus the grid's filter, this is confusing in and of itself.
If I activate the store filter, my store's query string parameters (passed to an Ajax handler) get passed like this:
Whereas if I use the grid filter, if looks like this:Code:page: 0 start: 0 limit: 50 filter: [{"property": "foo", "value": "bar"}]
So that's confusing of itself. I could adjust my server-side responder to listen for "property" if I activate the store filter, but then a user may grid filter the thing afterwards, and I'd have to listen for "field". Why the difference?Code:page: 0 start: 0 limit: 50 filter: [{"field": "foo", "value": "bar", "type": "string"}]
I'd like to just use the grid filter if I could, since that's what the client interacts with and I'd only have to listen for "field" (and updating the store's filter doesn't update the grid filter display, which I need it to do), but I'm not having any luck setting things programmatically for it and having it actually filter anything. I've tried grid's initComponent(), afterrender(), and so on. I get some variant of instance (grid.filters) undefined [like when I call this.filters.getFilter('foo')], or a filter's setValue() and setActive() methods simply not doing anything in regards to the grid.
What's the correct, Ext.js-idiomatic way to do this? I'm also attempting to use MVC, FWIW.


Reply With Quote