Question for string to color mapping in the dropdown list


I want to implement a feature in dropdown list to choose different color such as green, red, blue.
The drop-down list will show two columns, one column for the description of color, one column for the color itself. (Just like the number to color mapping as shown in below snapshot. We want to implement a string to color mapping in dropdown list).

But it seems that we can’t select “Color” type as a column in the dataset of dropdown list. So how could we achieve it? Is there any workaround?

You can use html to color what amounts to a table cell. It’s a bit old school, but it works.

<html><table width=1000 height=1000><tr><td bgcolor=black><font color=black>X

The ‘X’ at the end preserves the cell height when it displays.

A window to demonstrate. Note that I added a column to put a friendly name into, and a custom property to retrieve it: (4.0 KB)

Thread for reference. I had a similar issue with a table back in 2009. Fire up the wayback machine!


Really appriciate your help, It works

1 Like