You found a bug! We've classified it as EXTJS-8688 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    42
    Vote Rating
    4
    Dev@QLP is on a distinguished road

      0  

    Question 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:
    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
            });
    However it is disabled by default so I was puzzled when I saw it being added to my store autoload query string parameters:
    Code:
    method:getSalesReps
    _dc:1360768150232
    page:1
    start:0
    limit:25
    filter:[{"property":"full_name"}]
    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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What Ext JS 4.x.x version? And can I get a locally runnable testcase?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    42
    Vote Rating
    4
    Dev@QLP is on a distinguished road

      0  

    Question


    Quote Originally Posted by mitchellsimoens View Post
    What Ext JS 4.x.x version? And can I get a locally runnable testcase?
    Here are the script and css tags I'm referencing:
    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>
    I'm using the latest beta for 4.2.0.489. Here is my code:
    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
            });
        });
    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.

    I'll try to attach a screen shot of my the http request parameters:
    queryString.jpg

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    27
    Vote Rating
    2
    bizbox is on a distinguished road

      0  

    Default 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 versions tested against:
    • Browser independent
    Description:
    • Parameter filter=[{"property":"name"}] is automaticaly added into combobox store load request parameters
    Steps to reproduce the problem:
    • Try example and see request parameters in firebug
    The result that was expected:
    • No additional filter parameters in request
    The result that occurs instead:
    • Parameter filter=[{"property":"name"}] appeared in request parameters
    Test Case:
    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  ]
            } );                
        }
    } );

  5. #5
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    52
    Vote Rating
    3
    extjs@kingsquare.nl is on a distinguished road

      0  

    Default


    Same issue still exists In 4.2.0 (release)

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    This has been reported, and fixed in the codebase. The override is available here: http://www.sencha.com/forum/showthre...l=1#post946177

  7. #7
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    42
    Vote Rating
    4
    Dev@QLP is on a distinguished road

      0  

    Default


    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;
        },

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Yes, disabled filters should not be applied.

  9. #9
    Sencha User Sharkanana's Avatar
    Join Date
    Nov 2011
    Location
    Charlotte, NC
    Posts
    39
    Vote Rating
    0
    Sharkanana is on a distinguished road

      0  

    Default


    I am still seeing a bug here.

    The combobox initcomponent does:

    Code:
    me.queryFilter = new Ext.util.Filter({
                id: me.id + '-query-filter',
                disabled: true,
                root: 'data',
                property: me.displayField
            });
            store.filter(me.queryFilter);
    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.

    I think a solution may be to do

    Code:
    store.filters.add(me.queryFilter);
    instead, not triggering a load...but adding the filter to the array.
    Last edited by Sharkanana; 22 Apr 2013 at 7:12 AM. Reason: adding possible solution