cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to display text <None> in an empty dropdown list

khayes1
13-Aquamarine

How to display text <None> in an empty dropdown list

Hi,

I have a dropdown list widget which is populated from a service which returns an infotable, it all works fine. However, there are times when it is perfectly valid for there to be no returned rows in the infotable. When this happens I would like to display the text "< none >" in the header row when the drop down is not activated. Ideally I'd like to use some form of state formatting so the text would be grey.

Does anyone know how I might achieve this? I have tried putting "< none >" in the TextNoSelection property for the widget, but this appeared to do nothing.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
dmcclelland
5-Regular Member
(To:khayes1)

<none> gets sanitized but --none-- worked when I tried it in the TextIfNoSelection property.textIfNoSelection.png

View solution in original post

6 REPLIES 6

I don't think there's an option to do it right on the widget properties. But you my try other approaches:

  1. When no rows, your service can return a fake row with (none) text, if you want to have a different formatting for this special row then you can use ListFormat for this special entry.
  2. You can play around with two widgets, (showing/hiding) them, I mean a Label widget and a DropDown, when your service doesn't returns any row you hide the dropdown and show the Label one and viceversa.

Best Regards,

Carles.

khayes1
13-Aquamarine
(To:CarlesColl)

Hi Carles,

thanks for the quick reply. I Think I'll go with one of your options. I had thought of #2 but thought that maybe there was some built in list widget functionality I was missing. Do you know how the TextNoSelection ​widget property is supposed to work. Didn't seem to do anything for me, even when I didn't select any item in the list..

Thanks again.

Neither for me, never ever get it to work.

khayes1
13-Aquamarine
(To:CarlesColl)

Hi Carles,

hope you don't mind, I marked Mac's answer as correct instead as it seemed a better answer for people that might want to know.

dmcclelland
5-Regular Member
(To:khayes1)

<none> gets sanitized but --none-- worked when I tried it in the TextIfNoSelection property.textIfNoSelection.png

khayes1
13-Aquamarine
(To:dmcclelland)

Hi Mac,

apologies for the late reply. you're quite right, '-- none --' works fine.

Top Tags