Adding dynamic data in Pickerlist of a Select Item

Hi,
I have a particular requirement in which i want to add a custom option/item to the pickerlist of a select item, which is populated by a databound fetch from DB. I want to add a custom option based on a certain condition to this result set in the pickerlist, so that it is visible as an option in that databound select item.

I tried adding that as the defaultValue of the select item, but found that the option exists no longer after the option is changed.

How can i add data to a result set on the fly, such that i can see it as an option for the select item and any time during the session i should be able to select the custom option? Or, are there any other work around that you would like to suggest?

Thank you.

Hello ev.kaushik,

If the value you want to add is considered an “empty value” (eg absence of criteria or “All” / “Any”), you could use the allowEmptyValue property.

Otherwise, if you need to add some other kind of entry, you are probably best off using dataSource.fetchData() to fetch the data, and providing a static valueMap derived from that data rather than using optionDataSource. See the docs for DataSource.fetchData() for a similar example.