How to clear list-fancy-select?

Skip to first unread message

Nov 3, 2021, 9:58:01 AM11/3/21
to Joomla! General Development
Does anyone know how to programically clear list with layout="joomla.form.field.list-fancy-select" or layout="joomla.form.field.groupedlist-fancy-select"?
Functionality seems to be based on choices.js.
Thanks for any help.

Daniel H

Jan 12, 2022, 4:03:38 AM1/12/22
to Joomla! General Development
in my case, I tried to load new items via requestLookup() method. But new items will only be added, not replaced. This is because the reset flag is set to false (see call "this.choicesInstance.setChoices(items, 'value', 'text', false);". The fourth parameter is the flag for clearing old items. The problem is, this flag is hardcoded and cant be set to true.

Maybe this is the same problem you got. To fix it, changes need to be made in joomla-field-fancy-select[.min].js. The solution could be to implement an option in the requestLookup() method, eg. requestLookup(resetItems = false) and set this option for the setChoices call for the reset flag.
Reply all
Reply to author
0 new messages