Changeset 13288
- Timestamp:
- 04/08/08 15:38:57 (8 months ago)
- Location:
- dijit/trunk
- Files:
-
- 5 modified
-
form/ComboBox.js (modified) (4 diffs)
-
tests/form/test_ComboBox.html (modified) (2 diffs)
-
themes/nihilo/form/Common.css (modified) (1 diff)
-
themes/soria/form/Common.css (modified) (1 diff)
-
themes/tundra/form/Common.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/ComboBox.js
r13269 r13288 39 39 autoComplete: true, 40 40 41 // highlightMatch: Boolean 42 // If the ComboBox opens with the serach results and the searched 43 // string can be found it will be highlighted. 44 // This value is not considered when labelType!="text" to not 45 // screw up any mark up the label might contain. 46 highlightMatch: true, 47 41 48 // searchDelay: Integer 42 49 // Delay in milliseconds between when user types something and we start … … 506 513 this.item = null; // #4872 507 514 var query = dojo.clone(this.query); // #5970 515 this._lastInput = key; // Store exactly what was entered by the user. 508 516 this._lastQuery = query[this.searchAttr] = this._getQueryString(key); 509 517 // #5970: set _lastQuery, *then* start the timeout … … 625 633 626 634 _getMenuLabelFromItem:function(/*Item*/ item){ 627 return { 628 html: this.labelType=="html", 629 label: this.store.getValue(item, this.labelAttr || this.searchAttr) 630 }; 635 var label = this.store.getValue(item, this.labelAttr || this.searchAttr); 636 var labelType = this.labelType; 637 // If labelType is not "text" we don't want to screw any markup ot whatever. 638 if (this.highlightMatch==true && this.labelType=="text" && this._lastInput){ 639 label = this.doHighlight(label); 640 labelType = "html"; 641 } 642 return {html: labelType=="html", label: label}; 643 }, 644 645 doHighlight:function(/*String*/label){ 646 // summary: 647 // Highlights the string entered by the user in the menu, by default this 648 // highlights the first occurence found. Override this method 649 // to implement your custom highlighing. 650 var rx = new RegExp("("+this._lastInput+")", "i"); 651 return label.replace(rx, '<span class="dijitComboBoxHighlightMatch">$1</span>'); 631 652 }, 632 653 … … 653 674 "dijit.form._ComboBoxMenu", 654 675 [dijit._Widget, dijit._Templated], 655 656 676 { 657 677 // summary: -
dijit/trunk/tests/form/test_ComboBox.html
r13269 r13288 205 205 </div> 206 206 <hr> 207 <p>ComboBox #4: url, autoComplete=false required=true :</p>207 <p>ComboBox #4: url, autoComplete=false required=true and highlightMatch=false</p> 208 208 <label for="combobox4">US State test 4: </label> 209 209 <input dojoType="dijit.form.ComboBox" … … 218 218 id="combobox4" 219 219 required="true" 220 highlightMatch="false" 220 221 > 221 222 <span>Value: <input id="value4" disabled></span> -
dijit/trunk/themes/nihilo/form/Common.css
r12100 r13288 81 81 background: transparent url('../images/warning.png') no-repeat center center; 82 82 } 83 84 /* The highlight is shown in the ComboBox menu. */ 85 .nihilo .dijitComboBoxHighlightMatch { 86 background-color:#d3d3d3; 87 } -
dijit/trunk/themes/soria/form/Common.css
r12104 r13288 81 81 background: transparent url('../images/warning.png') no-repeat center center; 82 82 } 83 84 /* The highlight is shown in the ComboBox menu. */ 85 .soria .dijitComboBoxHighlightMatch { 86 background-color:#f9f7ba; 87 } -
dijit/trunk/themes/tundra/form/Common.css
r13051 r13288 125 125 background: url("../images/validationInputBg.gif") repeat-x top left #fff; 126 126 } 127 128 /* The highlight is shown in the ComboBox menu. */ 129 .tundra .dijitComboBoxHighlightMatch { 130 background-color:#a5beda; 131 }