UI Builder - Assign CSS class dynamically to a component within a repeater? (Yokohama)

Yann Dubois2
Tera Expert

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.

2 REPLIES 2

Dinesh Chilaka
Giga Guru

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

kaushal_snow
Giga Sage

@Yann Dubois2 ,

 

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.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer