Changeset 13993

Show
Ignore:
Timestamp:
06/13/08 05:28:33 (5 months ago)
Author:
liucougar
Message:

refs #5974: no need to use our own hack in editor plugin for blank entry in dropdown list

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/_editor/plugins/FontChoice.js

    r13977 r13993  
    7474                        //items.push({label: "", name:"", value:""}); // FilteringSelect doesn't like unmatched blank strings 
    7575 
    76                         this.inherited(arguments,[{ labelType: "html", labelAttr: "label", searchAttr: "name", store: new dojo.data.ItemFileReadStore( 
     76                        this.inherited(arguments,[{required:false, labelType: "html", labelAttr: "label", searchAttr: "name", store: new dojo.data.ItemFileReadStore( 
    7777                                        { data: { identifier: "value", items: items } })}]); 
    7878 
    79                         //overload isValid/setValue to not show any validate error: if invalid, just show empty in the widget 
    80                         this.button.isValid = function(){ return true; }; 
    81                         this.button.setValue = function(/*String*/ value, /*Boolean?*/ priorityChange){ 
    82                                 //copied from FilteringSelect.setValue, just added one line 
    83                                 //TODO: is there a better way to achieve this? or shall we add a hook to 
    84                                 //FilteringSelect.setValue to allow inserting a _setValue more easily? 
    85                                 var self=this; 
    86                                 var handleFetchByIdentity = function(item, priorityChange){ 
    87                                         if(item){ 
    88                                                 if(self.store.isItemLoaded(item)){ 
    89                                                         self._callbackSetLabel([item], undefined, priorityChange); 
    90                                                 }else{ 
    91                                                         self.store.loadItem({ 
    92                                                                 item: item,  
    93                                                                 onItem: function(result, dataObject){ 
    94                                                                         self._callbackSetLabel(result, dataObject, priorityChange); 
    95                                                                 } 
    96                                                         }); 
    97                                                 } 
    98                                         }else{ 
    99                                                 self._isvalid=false; 
    100                                                 self.validate(false); 
    101                                                 self._setValue('','',false); //added this line to reset the input field to empty 
    102                                         } 
    103                                 } 
    104                                 this.store.fetchItemByIdentity({ 
    105                                         identity: value,  
    106                                         onItem: function(item){ 
    107                                                 handleFetchByIdentity(item, priorityChange); 
    108                                         } 
    109                                 }); 
    110                         } 
    11179                        this.button.setValue(""); 
    11280