jeremyblaze/Dropzie

Tag mode change seems to store first change and nothing else

Opened this issue · 0 comments

Essentially, I want to use the dropzie tag selector, and update the original select options when selected. To do this, each time the dropzie is changed, I grab the id (was able to pass all custom data-attributes into the dropzieoptions, see #1) and if it's selected, grab the original option by that id and make it selected.

It works, but only on the first change event. Any time after, it somehow stores or logs the state after the first event and only refers to that. So for example, say I have tags 1 2 and 3. If I select tag 1
$('#myForm .dropzieOption').each( function() {
id = $(this).data('id')
selected = $(this).data('selected')
console.log(id+' '+selected)
results in
1 true
2 false
2 false
which is expected and correct. However, if I select 2, 3, or even deselect 1, I still get
1 true
2 false
2 false
Which is incorrect. I tried stumbling my way through fixing it, but I'm by no means good at js.

Recreating this issue should be as simple as setting up a tagmode dropzie with a multiselect select, and testing out the change function.