Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#6461 closed enhancement (fixed)

ComboBox: Highlight the search string in items in the drop down

Reported by: wolfram Owned by: wolfram
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.0
Keywords: Cc:
Blocked By: Blocking:

Description


Change History (14)

comment:1 Changed 12 years ago by wolfram

Resolution: fixed
Status: newclosed

Fixed by [13288]

comment:2 Changed 12 years ago by bill

Milestone: 1.2
Resolution: fixed
Status: closedreopened
Summary: Highlight the search string in the drop down of a ComboBoxComboBox: Highlight the search string in items in the drop down

Unfortunately this isn't going to work if search string and/or returned results have special characters in them.

So for example, if the user types in "lt>" and it matches an item called "lt><&lt", make sure the highlighting works correctly in that case.

comment:3 Changed 12 years ago by Douglas Hays

Milestone: 1.21.3

comment:4 Changed 12 years ago by bill

Owner: set to wolfram
Status: reopenednew

Wolfram is working on this so assigning to him. I think the code checked in in [13288] just needs to be changed to first convert both the search string and the item from plain text to HTML; 0.4 had a function for this but unfortunately was removed in 0.9. However, there is code in InlineEditBox and/or TextArea to do the same thing:

value = value.replace(/&/gm, "&amp;").replace(/</gm, "&lt;").replace(/>/gm, "&gt;").replace(/"/gm, "&quot;")
.replace(/\n/g, "<br>");

comment:5 Changed 12 years ago by wolfram

Resolution: fixed
Status: newclosed

(In [13340]) + encode HTML entities properly, so they at least dont screw up the markup fixes#6461

comment:6 Changed 12 years ago by wolfram

(In [13341]) + mainly serves as example data refs#6461

comment:7 Changed 12 years ago by wolfram

(In [13343]) + optimized refs#6461 as of Bill's suggestion, thx

comment:8 Changed 12 years ago by wolfram

(In [13614]) + refs#6461, make highlightMatch take one of: first, all, none

comment:9 Changed 12 years ago by wolfram

(In [13615]) + refs#6461, make highlightMatch find matches only at the beginning of a string and at word boundaries, this is more natural

comment:10 Changed 12 years ago by Adam Peller

Milestone: 1.31.2

comment:11 Changed 11 years ago by guest

Comments in ComboBox?.js indicate that doHighlight() should be overridden for custom highlighting, but _lastInput is not passed to this method. User must access the private variable _lastInput to override. Ideally, I think, pass in "this._escapeHTML(this._lastInput)" as second parameter to doHighlight(), giving user everything he needs to cleanly override. Many thanks!

comment:12 Changed 11 years ago by wolfram

Great idea, thx

comment:13 Changed 11 years ago by wolfram

done in [13979]

comment:14 Changed 9 years ago by bill

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