vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
732 stars 284 forks source link

multi_select not working "The select2('close') method was called on an element that is not using Select2." #500

Closed xinli-wu closed 5 years ago

xinli-wu commented 6 years ago

Thank you for your wonderful work!

I'm just having an issue with multi_select's select2 type. the columns are just strings, it gives me 4 errors in the following order after I click on the filter:

  1. The select2('close') method was called on an element that is not using Select2.
  2. Uncaught TypeError: Cannot read property 'close' of undefined
  3. The select2('close') method was called on an element that is not using Select2.
  4. Uncaught TypeError: Cannot read property 'close' of undefined

Note, I only clicked on the filter in the header once. If I click it again, it gives me another 4 errors in the above order. Selec2 is already included before yadcf.

Regards, X

vedmack commented 6 years ago

You are welcome,

Please provide a simple test page (jsfiddle)

pcapp2114 commented 5 years ago

Hello, I have the same issue and errors. In this example I have 2 filters and only 1 is using select2. Watch the console, click on either filter and you will see the error The select2('close') method was called on an element that is not using Select2. https://jsfiddle.net/Paul2167/zusvc4ra/. In this example I have 2 filters and they both use select2 and there is no error. Watch the console, click on either filter. https://jsfiddle.net/Paul2167/nxgvbr57/

I also posted this issue here: https://datatables.net/forums/discussion/53685/error-the-select2-close-method-was-called-on-an-element-that-is-not-using-select2 Thank you

pcapp2114 commented 5 years ago

@vedmack Should I post a new question? Paul

vedmack commented 5 years ago

@pcapp2114 , no need in opening a new one

Wouter8 commented 5 years ago

I get this error as well. It occurs only when enabling the scroller plugin of DataTables. With it disabled everything works as expected.

vedmack commented 5 years ago

@Wouter8 please provide a jsfiddle test case

Wouter8 commented 5 years ago

@vedmack on it.

Wouter8 commented 5 years ago

I think this is it. https://jsfiddle.net/xpvt214o/1005405/

Should add that the error pops up in my project on clicking the select the first time. But I'm also using a lot more plugins and only disabling the scroller fixes it. So pretty sure if that gets fixed my errors will be gone too.

vedmack commented 5 years ago

@Wouter8 404 That page doesn't exist.

Wouter8 commented 5 years ago

I'm sorry. I thought it already saved when that link was in my URL bar.

This one should work: https://jsfiddle.net/oty1dewr/ @vedmack

Wouter8 commented 5 years ago

@vedmack could you update me if you made any progress to fixing this? I'm currently buildling something for production and the scroller functionality is needed to keep the site responsive.

Thanks for the great plugin already!

pcapp2114 commented 5 years ago

@vedmack I updated the example that has the error and disabled the scroller, but I do not think this is enabled by default. I still see the erro rfor select2('close') method on the first filter that is using select2. I thought the error occurred when clicking either filter but it only happens on the first filter with the label "first" https://jsfiddle.net/Paul2167/zusvc4ra/. I read that enabling the scroller improves performance. I will most likely use this now becasue we want to load up to 3000 json items.

vedmack commented 5 years ago

@Wouter8 @pcapp2114 , this was a small issue... already fixed in 0.9.4.beta.12 , until I release it you can grab it from my dropbox temp file

pcapp2114 commented 5 years ago

@Wouter8 In your example I see the error when the page first loads. I did not have to click a filter. I disabled the scroller in my example but I still get the same close method error I had before. I placed the Select2 CDN above the Yadcf CDN. https://jsfiddle.net/Paul2167/zusvc4ra/

vedmack commented 5 years ago

@Wouter8 @pcapp2114 its aready fixed, see my previous comment and attached link

Wouter8 commented 5 years ago

@Wouter8 Thanks, gonna try it out right away. Thanks for the quick fix. Amazing! :)

Wouter8 commented 5 years ago

Working like a charm. I think this can be closed.

pcapp2114 commented 5 years ago

@vedmack Thank you. Yes 0.9.4.beta.12 Fixes the error for select2('close') method. I tested it. Is it possible to add this to jsfiddle? It only allows CDN's I don't see a way to add a custom js file.

pcapp2114 commented 5 years ago

I also enabled the scroller with the new beta 12. I don't have the other error. TypeError: Cannot read property 'appendChild' of undefined. Nice work. Thank you @vedmack

vedmack commented 5 years ago

fixed in 0.9.4.beta.12, npm version published too