ender2021 / jQuery-Dual-Listbox-v2.0

3 stars 2 forks source link

exchange-items button is changing all my dual lists (instead of just the one I touched) #3

Open protron opened 11 years ago

protron commented 11 years ago

If you have more than a dual list in the same page you will see that it doesn't matter which exchange-items button you press: all the dual lists will exchange its items every time you press any of them.

Sample here: http://jsfiddle.net/protron/fdYW5/

protron commented 11 years ago

I fixed myself by doing these changes:

  1. Removing the line 259 (items: [],)
  2. Adding this.items = []; in a new line inside the init function. I've placed it just after the $.extend(...); in line 95.

This way, the variable "items" will to be stored in each instance of the dual list (instead of being inside the prototype, which is shared between instances).

After those changes, the button will exchange only the items on the corresponding dual list. And the rest of the functionality seems to be working without any problems.

Maybe (if I see no response on these) I'll create a fork of this nice project and apply this fix and the other one I posted about the _options variable.