How to update the options of a select list?
How to update the options of a select list?
hi,
when updating the options of a select list, according to the data of a table in my database, I need the first option to be a message, something like "Please select one of the following". So, I tried this:
...
{
"label": "list",
"name": "tableID.list",
"type": "select",
"ipOpts": [
{
"label": "Please select",
"value": 0
}
]
}
...
and then,
editor.field( 'tableID.list' ).update( ... );
But it doesn't seem to make any difference, meaning that I still see only the options that come from the database. Is there a way I can do it?
Thanks!!!
This discussion has been closed.
Answers
The
update()
method will completely replace the list of options available, so you would need to also include the "Please select" in that list.Allan