Allow distinct styling of matching characters
See original GitHub issueRight now, the entire result is placed in a div. Given the example template:
<ResultTemplate>
@context.Title (@context.Year)
</ResultTemplate>
, a result div might be:
<div class="blazored-typeahead__result ">
"The Shining"
"(1977)"
</div>
If I searched for Shi, I would like the following instead:
<div class="blazored-typeahead__result ">
"The "
<span class="blazored-typeahead__result_match">
"Shi"
</span>
"ning"
"(1977)"
</div>
I could then supply styling information for that class and make matching characters bold, underline, or similar:
.blazored-typeahead__result_match
{
font-weight: bold
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Regex to match string of unique characters - java
Matches the literal GO , followed by: Any character A-Z, from zero to infinite times; asserting, for each character encountered, ...
Read more >Python | Count the Number of matching characters in a pair ...
Count the number of matching characters in those strings (consider the single count for the character which have duplicates in the strings).
Read more >Regular Expression (Regex) Tutorial
(Range Expression): Accept ANY ONE of the character in the range, e.g., [0-9] matches any digit; [A-Za-z] matches any uppercase or lowercase letters....
Read more >How to test if all characters in a string a unique with vanilla ...
This method always returns the index of the first matching character. If the current character is a duplicate, the returned index won't ...
Read more >SQL LIKE Pattern Matching Tutorial
Use LIKE to filter SQL records on specific string matches. This tutorial teaches you to use wildcards, NOT, LOWER, UPPER, and CASE WHEN...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s possible to get the searchvalue each time the searchmethod is triggerd. CAUTION Some very RAW code examples here, but I think you’ll get the point:
then you know the searchtext and you’re able to use it in a renderfragment for your
resulttemplate
Caution, I stole this code from somewhere, I didn’t battle test it at all.
Which results in:
Nope. Haven’t had a chance to look into this for now.
One approach might be to add an
out IRange[] highlightedCharacterRanges
parameter to the expectedSearchMethod
.I’m not sure this would work well for complex
ResultTemplate
scenarios, though.