How to set Display Value for option in Select component - UI Builder

Bartek0301
Tera Contributor

Hello,

 

I have a data resource which returns active groups which names contains "desk".

I want to add to the page a select component which allows to pick one of the group from this data resource. I've linked this select box items with data resource but when I want to test I can see a list of items but their display value is empty. 

 

The results of my data resource looks like the following (I have more items - this is just for example):

 

 

[
  {
    "_row_data": {
      "displayValue": "Nimsoft desk",
      "uniqueValue": "10e39a5673500010c2e7660c4cf6a7ef"
    },
    "name": {
      "value": "Nimsoft desk",
      "displayValue": "Nimsoft desk"
    }
  }
]

 

 

 

I believe this is because each item is an object and a default display value for an object is something like empty string, but then how can I use <object>.name.displayValue to see a display Value of each item in select component?

1 ACCEPTED SOLUTION

Dibyaratnam
Tera Sage

In select component you need to pass these values in the form of Array of items, each containing id & label

[{"id":"usr1","label":"User 1"},{"id":"usr2","label":"User 2"}]

so you need to convert your data resource o/p into the same format and then set the List items property to the newly created array of items.

View solution in original post

2 REPLIES 2

Dibyaratnam
Tera Sage

In select component you need to pass these values in the form of Array of items, each containing id & label

[{"id":"usr1","label":"User 1"},{"id":"usr2","label":"User 2"}]

so you need to convert your data resource o/p into the same format and then set the List items property to the newly created array of items.

Thank you,

That is so simple and visible in data example.