ivaynberg / wicket-select2

Provides integration between Apache Wicket and Select2
64 stars 50 forks source link

Updating of Select2MultiChoice via Ajax works in Firefox, but not in IE #37

Closed tgoetz closed 11 years ago

tgoetz commented 11 years ago

I have a Select2MultiChoice that uses an IModel<Collection<T>> to get the list of available choices. The calculated list depends on some other value in the same form. So, what I did is: I attached an AjaxBehavior to that other component (e.g. a RadioGroup) and add the Select2MultiChoice to the AjaxRequestTarget.

This works fine in Firefox, but not in IE (8). IE does not trigger a new Ajax request when I click (or type) into the Select2.

I created a Quickstart to demonstrate the behavior: http://cl.ly/1q42262H3j20

tgoetz commented 11 years ago

I already looked around a bit in select2.js, but have no clue yet what could cause that different behavior between FF and IE, maybe you have an idea?

ivaynberg commented 11 years ago

nothing jumps out at me off the top of my head. are there any javascript errors in IE after the update? what does the wicket ajax console say?

tgoetz commented 11 years ago

Well, unfortunately there are no JS errors, and the ajax console doesn't help either. Are you able to reproduce this?

tgoetz commented 11 years ago

Did you find some time to think/look at this? Currently we are using select2 components throughout all of our applications, but this blocks us, as we need to update them via ajax. I'm not too keen on going with one of the alternatives (e.g. AutoCompleteTextField), but therefore need to get this fixed. Any kind of help/hint/something is appreciated!

ivaynberg commented 11 years ago

no. havent had time yet. sorry.

ivaynberg commented 11 years ago

ok. figured out what was going on. IE unlike other browsers cached the ajax request - that is why when select2 initially opened it would show the old results but when something was typed into the search field the correct results would be shown.

i fixed this in select2#807 and monkey patched it in master of this project.

alternatively you can override the ajax data helper and return some key in the map with Math.random() which will effectively disable the caching - if you cannot use the master branch here.

tgoetz commented 11 years ago

Nice work, thanks for you time! Time for a 2.2 release (maybe including #33)?! ;-)

ivaynberg commented 11 years ago

pull request to apply #33 to master is welcome :)