Opened 10 years ago

Closed 9 years ago

#14099 closed defect (fixed)

[regression] FilteringSelect: doesn't pass a string as query to stores

Reported by: ben hockey Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit - Form Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:


in the store backwards compatibility shim in ComboBoxMixin?, the query that is passed to fetch has a property matching the searchAttr that is meant to look like a string - ie it has a toString but it's not actually a string. this causes problems when a store tries to do something like:

if ( {
  // this line fails because is not a string anymore
  var phone = /* RegExp to match phones */ );
  if (phone) {
    // make a query to search based on phone
  else {
    // make a query to search based on name

Change History (6)

comment:1 Changed 10 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill

comment:2 Changed 9 years ago by bill

Hmm, that's strange, are you sure? Because there's code in _AutoCompleterMixin to pass a string:

var qs = this._getQueryString(key),
	q = ? qs : filter.patternToRegExp(qs, this.ignoreCase);
q.toString = function(){ return qs; };

Note the reference.

comment:4 Changed 9 years ago by ben hockey

sorry i didn't mention FilteringSelect? anywhere in the ticket - the code that wraps the old store is in ComboBoxMixin? and when i looked and didn't see anything there to deal with this i thought that was where the problem was. i guess _AutoCompleterMixin handles the query for some cases but FilteringSelect? was overlooked.

comment:5 Changed 9 years ago by bill

Milestone: tbd1.7
Status: newassigned
Summary: [regression] ComboBoxMixin doesn't pass a string as query to stores[regression] FilteringSelect: doesn't pass a string as query to stores

Ah that makes sense. OK I'll check in a fix for 1.7 today (assuming it doesn't freeze today).

comment:6 Changed 9 years ago by bill

Resolution: fixed
Status: assignedclosed

In [26896]:

For better back-compat, when connecting to legacy store, make sure searchAttr is an actual String rather than a Regex with a toString() method. This was done for ComboBox in [25771] but I missed the other case of FilteringSelect's reverse lookup.

Also avoid (unnecessarily) adding a toString() method to a String.

The code duplication is unfortunate but it will go away in 2.0.

Fixes #14099, refs #12373 !strict.

Note: See TracTickets for help on using tickets.