Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

Colored entries in Dropdown

BennyB
16-Pearl

Colored entries in Dropdown

Dear community,

 

I would like to color the entries of a Dropdown, like this:

ColoredDropdown.png

The Color would come with the InfoTable for the data feed. Anyone an idea how to do this?

 

Thanks

Benny

2 REPLIES 2

Yes, this is possible in ThingWorx using State-based Style Definitions on the Dropdown widget.

You can configure it in the following way:

  1. Click the Dropdown widget and go to the List Format property.

  2. In the renderer configuration, select State-based Style Definitions.

  3. Choose the Dependent Field (this should be the field that contains the value coming from your InfoTable).

  4. Create a State Definition where you define all the colors you want to use.

 

please see attached screenshot.

 

In the State Definition, you need to configure:

  • Value – the value coming from your data (for example F1, F2, F3, etc.)

  • Display Name – the readable label for that value

  • Style – the style definition that contains the color you want to display

Make sure that the same values you defined in the State Definition (e.g., F1, F2, F3, etc.) are stored in the DataTable / InfoTable that you bind to the dropdown.

Then in the Dropdown configuration:

  • ValueField should point to the field that contains those values (F1, F2, F3, etc.)

  • DisplayField should be the field containing the text you want to show to the user (for example “Red”, “Yellow”, “Green”, etc.)

Once the dropdown receives the values from the InfoTable and they match the values defined in the State Definition, ThingWorx will automatically apply the corresponding color styles to the entries.



Hey @MA8731174 ,

 

many thanks for your reply. I completely forgot about the StateDefinition. But it also does not fully cover my requirements. There is no chance to provide the color itself via the InfoTable, e. g. by Hex-Code, right?

 

Thanks

Benny

Announcements


Top Tags