I'm using select2 to display a nested array, which works just fine. Except for when the array values have children.
They then become bold and not selectable. This is my code.
//JQUERY 1.9
(function($){
$(document).ready(function() {
$.get('/classes/categories.php?do=buildtree&output=select2', function(treedata) {
datajson = $.parseJSON(treedata);
$(".select2productgroups").select2({
data: datajson,
placeholder: "Select a category",
});
});
});
})(jq)
This is my array generated by PHP (treedata)
[
{
"id": "0",
"text": "ALL PRODUCTS"
},
{
"id": "3",
"text": "PC Onderdelen",
"children": [
{
"id": "6",
"text": "Moederborden",
"children": [
{
"id": "7",
"text": "Midi Towers"
}
]
},
{
"id": "4",
"text": "Processoren",
"children": [
{
"id": "17",
"text": "moederbordensub"
}
]
},
{
"id": "8",
"text": "Laptops"
},
{
"id": "9",
"text": "Muizen",
"children": [
{
"id": "10",
"text": "Draadloos"
}
]
},
{
"id": "18",
"text": "Test categorie"
}
]
},
{
"id": "14",
"text": "Rootcat3"
},
{
"id": "19",
"text": "Inkt",
"children": [
{
"id": "20",
"text": "subname",
"children": [
{
"id": "27",
"text": "HP Inkt"
}
]
}
]
}
]
All groups have id, which is required to select them.
Can someone point me in the right direction, in order to be able to select 'PC onderdelen' for example.
Thanks! Roy
--
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.