Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#7495 closed defect (fixed)

FilteringSelect does not properly mixin fetchProperties inherited from ComboBoxMixin

Reported by: paulprince Owned by: haysmark
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description

ComboBoxMixin defines fetchProperties like this:

// fetchProperties: Object
//              Mixin to the dojo.data store's fetch.
//              For example, to set the sort order of the ComboBox menu, pass:
//              {sort:{attribute:"name",descending:true}}
fetchProperties:{},

However, FilteringSelect, in addition the the fetch()'s which get called in members inherited from ComboBoxMixin (which properly mixin fetchProperties), calls fetch() from _setDisplayedValueAttr() and fails to mixin fetchProperties at that time:

_setDisplayedValueAttr: function(/*String*/ label, /*Boolean?*/ priorityChange){
        // summary:
        //              Hook so attr('displayedValue', label) works.
        // description:
        //              Set textbox to display label. Also performs reverse lookup
        //              to set the hidden value.

        if(this.store){
                var query = dojo.clone(this.query); // #6196: populate query with user-specifics
                // escape meta characters of dojo.data.util.filter.patternToRegExp().
                this._lastQuery = query[this.searchAttr] = label.replace(/([\\\*\?])/g, "\\$1");
                // if the label is not valid, the callback will never set it,
                // so the last valid value will get the warning textbox set the
                // textbox value now so that the impending warning will make
                // sense to the user
                this.textbox.value = label;
                this._lastDisplayedValue = label;
                var _this = this; 
                this.store.fetch({
                        query: query,  
                        queryOptions: {
                                ignoreCase: this.ignoreCase, 
                                deep: true
                        },      
                        onComplete: function(result, dataObject){
                                        dojo.hitch(_this, "_callbackSetLabel")(result, dataObject, priorityChange);
                        },      
                        onError: function(errText){
                                console.error('dijit.form.FilteringSelect: ' + errText);
                                dojo.hitch(_this, "_setValue")("", label, false); 
                        }       
                });     
        }       
},

I've found fetchProperties to be quite useful, and I have had to subclass FilteringSelect (replacing _setDisplayedValueAttr) in order to fully make use of it.

This appears to just be an oversight... seems likely that whoever coded _setDisplayedValueAttr() simply wasn't aware that fetchProperties existed.

But maybe there is something I'm missing?

Change History (4)

comment:1 Changed 11 years ago by bill

Milestone: tbd1.2
Owner: set to haysmark

Hi Mark. This just an oversight or is there a reason for it?

comment:2 Changed 11 years ago by haysmark

Yes, this is an oversight.

comment:3 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

(In [14985]) Mixin fetchProperties for fetch() call in _setDisplayedValueAttr(). Fixes #7495 !strict.

comment:4 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.