Select2 populate another select2 tags

645 views Asked by At

I'm using select2 v4, I have a select2 that make an ajax request and return a nested array like:

[{"text":"item1","id":1,"user":[{"text":"item 1.1","id":1},{"text":"item 1.2","id":2}]},

with the second array ("user") I want to dinamically populate a select2 tags.

My problem is that when I want to add a tag (ajax request), initial values disappear.

This is a fiddle http://jsfiddle.net/Lmnfur4z/

(the only solution that I found is to nest the select2, if u have a more elegant solution is better)

Thanks in advance

G

0

There are 0 answers