Value in multiselectListbox Label is not reflecting in actual

Below is snapshot of a multiselectListbox component. (Using this community for the first time so not sure if the image is pasted appropriately)

As you can see, on hovering to the list, its showing the values, but if we look at the Mapped Array green box then the values are coming empty which seems to be contradictory with each other.
Could anyone please clarify this ?

Hello and welcome,

For "Mapped" option, the intention behind this is to

Use item to reference the current data source item being evaluated and i to reference the current index.

source: https://docs.retool.com/docs/define-option-lists#configure-mapped-options

image

As for your question, I was able to replicate it, see below.

image

I don't know if that is the intentional behavior or not. Hopefully someone from Retool can answer that. Personally, I would stay within the confine of mapped data source for the mapped options. Mixing with other sets of data in the mapped option can have many possible issues such as index out of bound and such.

If you need to additional data from other datasets, you can use SQL JSON with SQL or Transformer to combine data for the mapped options.

Hope that helps.

Thanks for the quick answer. Actually requirement is to have values of the multiselectListbox different so they are populated from Data Source which is working fine.


All data is populated from API response only.

But need to label multiselectListBox dropdown with some different values so that's why label option is populated with different parameter from API response. But as mentioned in the question, Label is not coming, and interestingly if I hardcorde the Label value as say with "hello", then hello is reflecting in the label of dropdown as shown below.

Could you or someone else from @Retool community please clarify this ?

Hi @Shivam_Tambi

Thanks for reaching out!

The label is looking for a single string to represent each "item." Could you try using the index, i, to key into your Alert_Data.value.userMasters array?

Thank you so much Tess for solution, though it seemed to be an easy one, but couldn't figure it out as I am quite new in Retool and Front end as well.
Thanks once again

Hi @Shivam_Tambi Thanks for letting me know! Welcome to Retool :slightly_smiling_face:

Does {{Alert_Data.value.userMasterNameList[i]}} have the expected behavior?

Hi @Tess retool has the expected behavior. Besides, one more query I have if you or retool team could help there then it will be great.
We have new table in retool, and we want to do server side sorting. So to do that we have two parameters, sortOrder(have asc or desc), and sortField(based on the column header selected) which can be passed in the API call. Now, the issue is we are unable to find click event for the column header as there are event handlers for selected row and cell, click and change cell, but nothing for column header click. So how to achieve that ?

Hi @Shivam_Tambi is your query an automatic query? Although we don't have a click event for the headers, the sort properties should change/recalculate upon clicking on the headers, which would trigger any automatic queries that reference the sort properties (in double curlies {{}}) to re-trigger

1 Like

Hi @Tess, relevant sort properties are changing on clicking the headers and API call is being watched on sort properties (sortArray specifically as answered by a retool team member @AnnaW in another question asked specifically for this) so query (API call) is triggered automatically on clicking header cells. The things are working as expected.
Thank you :slightly_smiling_face:

1 Like