How to clear list-fancy-select?

19 views
Skip to first unread message

pioa...@gmail.com

unread,
Nov 3, 2021, 9:58:01 AM11/3/21
to Joomla! General Development
Hi
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

unread,
Jan 12, 2022, 4:03:38 AM (10 days ago) Jan 12
to Joomla! General Development
Hi,
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
Forward
0 new messages