UI Builder - Assign CSS class dynamically to a component within a repeater? (Yokohama)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi,
I am building a hierarchical table view using a couple nested Repeaters to build the rows. Within the repeater I would like to assign the flex container or its collapse subcomponent alternating background colors. Is it possible to dynamically assign a css class to one of those components? if not, any thoughts on how I could get the alternating background colors for the rows? The client is on Yokohama.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Yann Dubois2 ,
Yes it is possible to dynamically add background for alternating rows with in the repeater.
If possible, could you share screenshots showing how the nested Repeaters are configured? That would make it much easier for everyone to follow and assist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
In ui builder on yokohama you cannot dynamically assign a css class or background color based on row index or data value inside a repeater..... because ui builder currently only supports static styling on components and does not allow data bound or script based css class assignments at runtime....so the typical workaround people use is to have two containers with different background colors in the repeater and then use conditional visibility (even/odd logic) to show the correct one per row......
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer
