Hi my json looks like:
data = [{
"id": "1",
"text": "group 1",
"children": [{
"id": "item1",
"text": "item1"
}, {
"id": "item2",
"text": "item2"
}]
}];
How can I make "group 1" selectable item? When item has childs I can't select it.
--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at http://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.
https://github.com/bnjmnhndrsn/select2-optgroup-select
The behavior is slightly different from what you were describing. Optgroups don't have values themselves. Rather, clicking on an optgroup toggles/untoggles all of the child elements. However, it could be a good example for building what you want.