Sort and Bold Catalog Item Select Box Results
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 07:47 AM
Hi all,
I have a Catalog Item with a Select Box that is being populated from a Catalog Client Script with and API call that returns JSON. The Select Box is displaying a combination of 2 fields from the API call. I would like to have 1 of the fields be Bold. I have tried numerous way to get the 1 field to display Bold but have not had any success. Any suggestions?
Also, I would like to have the Select Box results display alphabetically. Is the a way to sort?
Here is the function from the Catalog Client Script that populates the Select Box:
Thanks in advance for any suggestions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 09:29 AM
There is not a way to display rich text like bold, italics,... in the select box choices. The sort order is determined by the order the choices are added via addOption if you aren't supplying the fourth parameter which is the index. In this case, you would want to sort the array before it is returned to the client, or build a new object array of id:name[description], then sort that outside of the existing for loop before using addOption.