Ticket #4417: 4417.patch

File 4417.patch, 1.2 kB (added by doughays, 5 months ago)

id's were already being added in createOptions, so now just ask if the store if it has anything better to use before using the auto-generated id

  • form/ComboBox.js

     
    513513                        if(!this._popupWidget){ 
    514514                                var popupId = this.id + "_popup"; 
    515515                                this._popupWidget = new dijit.form._ComboBoxMenu({ 
     516                                        store: this.store, 
    516517                                        onChange: dojo.hitch(this, this._selectOption), 
    517518                                        id:popupId 
    518519                                }); 
     
    780781                        dojo.forEach(results, function(item, i){ 
    781782                                var menuitem = this._createOption(item, labelFunc); 
    782783                                menuitem.className = "dijitReset dijitMenuItem"; 
    783                                 dojo.attr(menuitem, "id", this.id + i); 
     784                                dojo.attr(menuitem, "id", this.store.getValue(item, "id") || (this.id + i)); 
    784785                                this.domNode.insertBefore(menuitem, this.nextButton); 
    785786                        }, this); 
    786787                        // display "Next . . ." button 
     
    10591060        getValue: function(     /* item */ item,  
    10601061                                                /* attribute-name-string */ attribute,  
    10611062                                                /* value? */ defaultValue){ 
    1062                 return (attribute == "value") ? item.value : (item.innerText || item.textContent || ''); 
     1063                return (attribute == "id")? item.id  : ((attribute == "value") ? item.value : (item.innerText || item.textContent || '')); 
    10631064        }, 
    10641065 
    10651066        isItemLoaded: function(/* anything */ something) {