tail.select.js icon indicating copy to clipboard operation
tail.select.js copied to clipboard

How to avoid the loop when removing all options

Open em-piguet opened this issue 2 years ago • 1 comments

I'm using the select to fetch some data for a calendar (fullcalendar.js) like this

var select_categories = tail.select(".select-categories", {
        search: true,
        multiSelectAll: true,
        locale: 'fr',
 });
select_categories.on("change", function(){
        calendar.refetchEvents();
}

the select has 19 options and it works great, but when i clic on "All" or "Remove all" the calendar.refetchEvents() event is called 19 times making 19 ajax requests which make the calendar very slow. In this situation how can i do to make only one request ?

em-piguet avatar Apr 05 '23 16:04 em-piguet

Can you cache the result of the refetchEvents()? I don't know how exactly it's working.

Also, if you think this is a tail.select issue, feel free to submit a PR.

wolffe avatar Apr 06 '23 09:04 wolffe