yadcf icon indicating copy to clipboard operation
yadcf copied to clipboard

Reload/refresh with large number of Select2 widget options hangs browser

Open dwasyl opened this issue 4 years ago • 4 comments

Hi there,

I'm running the latest beta build of yadcf and have run into a problem on filter reloads while in server side mode. I have one select2 multi_select widget that loads quite a few options (~1,500 or so). On the initial page load everything loads quickly without any problem, however whenever I do anything that involves a page or filter reload, it hangs the browser for ~15 seconds.

I narrowed it down by emptying out that one filter and it completely takes away the issue. I had thought moving select2 to Ajax loading of options might help, but since there is no delay on the initial page load, there might be something about the way the filter redraws the filters.

Any thoughts on how to deal with this?

dwasyl avatar May 02 '20 09:05 dwasyl

Well in case you have such a big select I would suggest thinking about make it more efficient, lazy loading upon user taps several letters or something, loading HTML select with 1.5K of options doesn't sound like a solution in any scenario.

vedmack avatar May 02 '20 16:05 vedmack

The list is based on a growing list of options, is there an easy way to enable the select2 module to use ajax loading for the list? That would avoid any slowness.

But, it's also strange that the delay only happens when doing a filter change and not on the initial load.

dwasyl avatar May 02 '20 16:05 dwasyl

@dwasyl Did you solve your problem? I have a similar problem, I have a lot of options in the select2 filter, which makes using the filter really laggy.

@vedmack Any idea on how we could solve this problem? How could be implement AJAX loading or is there another solution for working with a lot of options in a select2 (multi_select) filter?

btw. Thanks for this great plugin Daniel :)

YugoCode avatar Jan 08 '21 12:01 YugoCode

@YugoCode @dwasyl if you can provide a minimal test page on jsfiddle it might speed up the possible solution

vedmack avatar Jan 11 '21 21:01 vedmack