Forum Discussion

johnjohn-Peter's avatar
johnjohn-Peter
Iron Contributor
Aug 21, 2024
Solved

Color code my SharePoint choice column inside Details List layout inside Modern Search web part

I have a PnP Modern search's Search result web part. and i am using the "Details List" layout, as follow:-   And i added a slot named "LoadStatus", as follow:-     then inside the "M...
  • DaveMehr365's avatar
    Aug 23, 2024

    Hello johnjohn-Peter

     

    have you checked the item value without your custom layout? Is the value displayed?

    I think you don't need a slot configuration for this case.

     

    I use the following expression to show me a project status in the colors red, yellow or green, depending on the value:

     

    <div style="display: {{#if RefinableString104}}inline-block{{else}}none{{/if}};border-radius: 15px;padding: 5px 7px;margin: -5px 0 0 -7px;{{#if (eq RefinableString104 "Offen")}}color: #004E8C;background-color: #80C6FF;{{else if (eq RefinableString104 "Stopp")}}color: #A4262C;background-color: #FABBC3;{{else if (eq RefinableString104 "Late")}}color: #8F6200;background-color: #FFEBC0;{{else if (eq RefinableString104 "Working")}}color: #437406;background-color: #CAF0CC;{{else if (eq RefinableString104 "Done")}}color: #FFFFFF;background-color: #498205;{{else}}color: #666666;background-color: #E5E5E5;{{/if}}" data-value="{{RefinableString104}}">{{RefinableString104}}</div>

     

    Best, Dave

Resources