Ticket #6390: 6390.patch

File 6390.patch, 1.0 kB (added by haysmark, 9 months ago)

Fixes #6390. Expands filtering capabilities of _ComboBoxDataStore.

  • form/ComboBox.js

     
    11dojo.provide("dijit.form.ComboBox"); 
    22 
    33dojo.require("dijit.form.ValidationTextBox"); 
     4dojo.require("dojo.data.util.filter"); 
    45dojo.requireLocalization("dijit.form", "ComboBox"); 
    56 
    67dojo.declare( 
     
    10301031                //              will call `onComplete()` with the results of the query (and the argument to this method) 
    10311032 
    10321033                // convert query to regex (ex: convert "first\last*" to /^first\\last.*$/i) and get matching vals 
    1033                 var query = "^" + args.query.name 
    1034                                 .replace(/([\\\|\(\)\[\{\^\$\+\?\.\<\>])/g, "\\$1") 
    1035                                 .replace("*", ".*") + "$", 
    1036                         matcher = new RegExp(query, args.queryOptions.ignoreCase ? "i" : ""), 
     1034                        var matcher = dojo.data.util.filter.patternToRegExp(args.query.name, args.queryOptions.ignoreCase), // #6390 
    10371035                        items = dojo.query("> option", this.root).filter(function(option){ 
    10381036                                return (option.innerText || option.textContent || '').match(matcher); 
    10391037                        } );