-
13 Feb 2013 7:21 AM #1
Combobox with autoLoad store applies Filter?
Combobox with autoLoad store applies Filter?
I have a combobox that is configured to use a store that is being autoLoaded. I noticed some code was added to the combobox class to auto-add a queryFilter based on the displayfield:
However it is disabled by default so I was puzzled when I saw it being added to my store autoload query string parameters:Code:// Create the filter that we will use during typing to filter the Store me.queryFilter = new Ext.util.Filter({ id: me.id + '-query-filter', disabled: true, root: 'data', property: me.displayField });
Is this the expected behavior? This is causing problems because I had always assumed that there would be a value parameter as well as a property parameter whenever a filter querystring was sent back to the server.Code:method:getSalesReps _dc:1360768150232 page:1 start:0 limit:25 filter:[{"property":"full_name"}]
-
14 Feb 2013 9:31 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
What Ext JS 4.x.x version? And can I get a locally runnable testcase?
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.
-
15 Feb 2013 6:40 AM #3
Here are the script and css tags I'm referencing:
I'm using the latest beta for 4.2.0.489. Here is my code:Code:<link href="http://cdn.sencha.com/ext/beta/4.2.0.489/resources/ext-theme-classic/ext-theme-classic-all.css"> <script src="http://cdn.sencha.com/ext/beta/4.2.0.489/ext-all-dev.js"></script>
The idea being that I want to load all the data from the server once and then the combobox can just treat it as querymode: local.Code:Ext.onReady(function() { Ext.define('SR', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ {name: 'id', type: 'int'}, {name: 'full_name', type: 'string'}, {name: 'phone', type: 'string'}, {name: 'title', type: 'string'}, {name: 'email', type: 'string'} ] }); var myStore = Ext.create('Ext.data.Store', { autoLoad: true, model : 'SR', proxy : { type : 'ajax', url : '/com/qlp/crm/order/OrderStatusService.cfc?method=getSalesReps', reader : { type : 'json', root : 'root' } } }); var combo = Ext.create('Ext.form.field.ComboBox', { renderTo : Ext.getBody(), name : 'sales_rep_filter', fieldLabel : 'Sales Rep', labelWidth : 75, anchor : '99%', store : myStore, queryMode : 'local', enableKeyEvents : true, multiSelect : true, editable : false, displayField : 'full_name', valueField : 'id', emptyText : 'Select a Sales Rep', value : 0 }); });
I'll try to attach a screen shot of my the http request parameters:
queryString.jpg
-
15 Feb 2013 6:44 AM #4
Same problem
Same problem
I have same problem in our system with Ext JS 4.2.0.489 RC1 version
REQUIRED INFORMATION
Ext version tested:- Ext 4.2.0.489
- Browser independent
- Parameter filter=[{"property":"name"}] is automaticaly added into combobox store load request parameters
- Try example and see request parameters in firebug
- No additional filter parameters in request
- Parameter filter=[{"property":"name"}] appeared in request parameters
Code:Ext.define( 'myModel', { extend: 'Ext.data.Model', proxy: { type: 'ajax', url: '/users.json', reader: { type: 'json', root: 'users' } }, fields: [ { name: 'id', type: 'integer', required: true, label: 'Id' }, { name: 'name', type: 'string', required: true, label: 'Name' }, ] } ); Ext.application( { name: 'Combo test', appFolder: '', launch: function() { var me = this; var store = Ext.create('Ext.data.Store', { model: 'myModel', data : [] }); var formPanel = Ext.create('Ext.form.Panel', { title: 'Test form', items: [{ id: 'combo', name: 'combo', fieldLabel: 'Combobox', xtype: 'combobox', store: store, displayField: 'name', valueField: 'id' }], buttons: [{ text: 'Submit', formBind: true, handler: function() { var form = this.up('form').getForm(); form.getValues(); } }] }); Ext.create( 'Ext.container.Viewport', { layout: 'fit', renderTo: Ext.getBody(), items: [ formPanel ] } ); } } );
-
15 Mar 2013 7:33 AM #5
Same issue still exists In 4.2.0 (release)
-
15 Mar 2013 8:29 AM #6
This has been reported, and fixed in the codebase. The override is available here: http://www.sencha.com/forum/showthre...l=1#post946177
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
15 Mar 2013 8:43 AM #7
What about when you do a store.load(). It seems that the filter is still applied because the override is only for the filter() function. Should the same allDisabled logic be applied here so that disabled filters aren't sent with the store.load() method?
From Ext.data.AbstractStore.load:
Code:load: function (options) { var me = this, operation; options = Ext.apply({ action: 'read', filters: me.filters.items, sorters: me.getSorters() }, options); me.lastOptions = options; operation = new Ext.data.Operation(options); if (me.fireEvent('beforeload', me, operation) !== false) { me.loading = true; me.proxy.read(operation, me.onProxyLoad, me); } return me; },
-
15 Mar 2013 8:54 AM #8
Yes, disabled filters should not be applied.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
22 Apr 2013 7:10 AM #9
I am still seeing a bug here.
The combobox initcomponent does:
If you have remoteFilter:true and any non-disabled filters defined, this will trigger a load even if autoload is false when the combo/store are initialized.Code:me.queryFilter = new Ext.util.Filter({ id: me.id + '-query-filter', disabled: true, root: 'data', property: me.displayField }); store.filter(me.queryFilter);
I think a solution may be to do
instead, not triggering a load...but adding the filter to the array.Code:store.filters.add(me.queryFilter);
Last edited by Sharkanana; 22 Apr 2013 at 7:12 AM. Reason: adding possible solution
You found a bug! We've classified it as
EXTJSIV-8688
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote
