Results 1 to 4 of 4

Thread: ComboBox's enableRegEx is case sensitive

    You found a bug! We've classified it as EXTJS-10751 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default ComboBox's enableRegEx is case sensitive

    Hi,

    I have ComboBox with queryMode local. I've found the enableRegEx property, which allows me to apply a regular expression search and it will filter my drop-down's records. Btw, I'm using 4.2.x

    The problem I see is that this search is case sensitive. I took a look a the source code, specially the doQuery method and I'm overriding this:

    Code:
    me.queryFilter.setValue(me.enableRegEx ? new RegExp(queryString) : queryString);
    To this :
    Code:
    me.queryFilter.setValue(me.enableRegEx ? new RegExp(queryString, me.caseSensitive ? '' : 'i') : queryString);
    Is this a bug?

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Thanks for the report! I'm not 100% sure this is a 'bug', but your override seems sensible. We'll look into it. Thanks!

  3. #3

    Default

    Many thanks.

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2015
    Posts
    32

    Default

    any updates? I also added this feature via overwrite to ext5:

    Code:
    doLocalQuery: function(queryPlan) {
        var me = this,
            queryString = queryPlan.query,
            filters = me.getStore().getFilters(),
            filter = me.queryFilter;
    
        me.queryFilter = null;
        me.changingFilters = true;
        filters.beginUpdate();
        if (filter) {
            filters.remove(filter);
        }
    
        if (queryString) {
            var regExp = me.caseSensitive ? new RegExp(queryString) : new RegExp(queryString, 'i'); //NEW
    filter = me.queryFilter = new Ext.util.Filter({
                id: me.id + '-filter',
                anyMatch: me.anyMatch,
                caseSensitive: me.caseSensitive,
                root: 'data',
                property: me.displayField,
                value: me.enableRegEx ? regExp : queryString //MODIFIED
    });
            filters.add(filter);
        }
        filters.endUpdate();
        me.changingFilters = false;
    
        if (me.store.getCount() || me.getPicker().emptyText) {
            me.expand();
        } else {
            me.collapse();
        }
    
        me.afterQuery(queryPlan);
    }
    The very important issue is that the given config regExp and caseSensitive is not compatible.

    Kindly keep us informed.

Posting Permissions

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