Highlighting a word after sorting it using a repeater

mobile-prototyping
newbie-question

#1

Hi,

I am creating an e-commerce filter and sort by for reviews using the repeater.

I am trying to sort using a word ie button and with the repeater on content with buttons appear. However, is there a way to highlight the word, button and make it bold? (My content is placed in a column within the repeater)

What would be the best way to do this?


#2

Here’s a typeahead feature that does this.

typeahead.rp (63.3 KB)

This is the Set Text action that does the highlighting:

[[Item.name.substring(0, item.name.toLowerCase().indexOf(This.text.toLowerCase()))]][[Item.name.substring(Item.name.toLowerCase().indexOf(This.text.toLowerCase()), Item.name.toLowerCase().indexOf(This.text.toLowerCase()) + this.text.length)]][[Item.name.substring(Item.name.toLowerCase().indexOf(This.text.toLowerCase()) + This.text.length, Item.name.length)]]

Make sure to change the Set Text action to Rich Text and apply the bold to the middle expression like you see here.


#3

Hi,

Thank you for that. I can see its working for you. But Ive tried to apply that rich text code but its not working. If you click price it filters all the price but still doesn’t bold them.

Could you see what I am doing wrong?

Kind Regards
Maryam

Reviews_recovered.rp (7.3 MB)


#4

Based on how you have your interaction set up, no you can’t just copy/paste what I’ve provided, but can instead apply the same technique. The method is that the text is broken up into three parts: The beginning of the string until the first occurrence of the text to the be bolded, the string starting with the text to be bolded and for as many characters as that text is long, and then finally the rest of the string. The middle part is then bolded and the effect is achieved.

You’re going to have to modify it to probably use a variable that gets set depending on what filter you click. You’d set that variable to the text of the filter and use it in this expression (in place of this.text). However if the word is mentioned multiple times, this will only highlight the first occurrence.


closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.