Results 1 to 3 of 3

Thread: [4.2.2.1144] Ext.form.field.ComboBox#bindStore does not add queryFilter

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-11495 in 4.2.3.1477.
  1. #1
    Ext JS Premium Member GustavR's Avatar
    Join Date
    Jun 2009
    Posts
    59
    Vote Rating
    34
      1  

    Default [4.2.2.1144] Ext.form.field.ComboBox#bindStore does not add queryFilter

    REQUIRED INFORMATION
    Ext version tested:

    • Ext 4.2.1.883
    • Ext 4.2.2.1144

    Description:
    When binding a new store to a ComboBox the query filter gets lost.

    Steps to reproduce the problem:
    • Create ComboBox with store and queryMode 'local'
    • Execute a query
    • Bind another store to the ComboBox
    • Execute another query

    The result that was expected:
    • The query is executed and the store filtered

    The result that occurs instead:
    • The store is not filtered!

    Test Case:
    https://fiddle.sencha.com/?fiddle=v7#fiddle/v7
    Code:
    var firstStore = Ext.create('Ext.data.Store', {
            fields: ['text'],
            data: [{
                text: 'foo'
            }, {
                text: 'bar'
            }]
        }),
        secondStore = Ext.create('Ext.data.Store', {
            fields: ['text'],
            data: function() {
                var data = [];
                for (var i = 0; i < 50; i++) {
                    data.push({
                        text: 'text_' + i
                    });
                }
                return data;
            }()
        }),
        field = Ext.create('Ext.form.field.ComboBox', {
            queryMode: 'local',
            store: firstStore,
            renderTo: Ext.getBody()
        });
    
    console.log(field.doQuery('some query text')); // Query executed
    console.log(field.getStore().getCount()); // 0 - The store has no items left, all were filtered out
    
    console.log(field.bindStore(secondStore).getStore()); // secondStore - New store bound to combo box
    console.log(field.doQuery('some other query text')); // Query executed
    console.log(field.getStore().getCount()); // !FAIL! 50 - should be 0


    HELPFUL INFORMATION

    Possible fix:
    Code:
    Ext.define('Perbility.fix.form.field.ComboBox', {
        override: 'Ext.form.field.ComboBox',
        
        onBindStore: function(store) {
            var me = this,
                filter = me.queryFilter;
                
            me.callOverridden(arguments);
            
            if (filter) {
                store.addFilter(filter, false);
            }
        }
    });

  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    9,491
    Vote Rating
    255
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Nov 2015
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Thank you for report and fix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •