I have two trees on the same page, in different divs with different Ids. I have two json variables, say tree1Data and tree2Data.
If the two JSON objects have entries with the same id, only the first tree will render the conflicting node. The second tree will have that node missing.
Any ideas? Is there a singleton for storage under the scenes?
Example below (Note that Id 1 will only show in the first tree.
var measures = [
{ "id": "1", "parent": "#", "text": "Stuff1" },
{ "id": "200", "parent": "#", "text": "Stuff2" },
{ "id": "300", "parent": "#", "text": "Stuff" },
{ "id": "400", "parent": "#", "text": "Stuff" },
{ "id": "500", "parent": "#", "text": "Stuff" },
{ "id": "600", "parent": "#", "text": "Stuff" },
{ "id": "700", "parent": "#", "text": "Stuff" },
{ "id": "800", "parent": "#", "text": "Stuff" },
{ "id": "900", "parent": "#", "text": "Stuff" },
{ "id": "1000", "parent": "#", "text": "Stuff" },
{ "id": "1100", "parent": "200", "text": "Stuff*" },
{ "id": "1200", "parent": "200", "text": "Stuff*" },
{ "id": "1300", "parent": "500", "text": "Stuff" },
{ "id": "1400", "parent": "500", "text": "Stuff" },
{ "id": "2300", "parent": "1400", "text": "Stuff" },
{ "id": "3500", "parent": "1400", "text": "Stuff" },
{ "id": "3600", "parent": "1400", "text": "Stuff" },
{ "id": "3700", "parent": "1400", "text": "Stuff" }
];
var treeConfig = {
'core': {
'theme': { "variant": "small" },
'data': measures
},
'plugins': ["checkbox", "wholerow", "sort"],
'checkbox': { "three_state": true }
};
var geoTree = $("#geoTree").jstree(treeConfig);
var tree = $('#tree').jstree({
'core': {
'theme': { "variant": "small" },
'data': [
{ "id": "1", "parent": "#", "text": "Age"},
{ "id": "2", "parent": "#", "text": "Gender" },
{ "id": "3", "parent": "#", "text": "Education" },
{ "id": "4", "parent": "#", "text": "Employment" },
{ "id": "5", "parent": "#", "text": "Family Composition" },
{ "id": "6", "parent": "#", "text": "Financial Attributes" },
{ "id": "7", "parent": "#", "text": "Housing Attributes" },
{ "id": "8", "parent": "#", "text": "Language" },
{ "id": "9", "parent": "#", "text": "Marital Status" },
{ "id": "10", "parent": "#", "text": "Military Status" },
{ "id": "11", "parent": "2", "text": "Male*" },
{ "id": "12", "parent": "2", "text": "Female*" },
{ "id": "13", "parent": "5", "text": "Expecting" },
{ "id": "14", "parent": "5", "text": "Age of Children" },
{ "id": "23", "parent": "17", "text": "Age 05-10 - Children" },
{ "id": "35", "parent": "17", "text": "Age 00-02 - Infants" },
{ "id": "36", "parent": "17", "text": "Age 02-05 - Toddlers" },
{ "id": "37", "parent": "17", "text": "Age 10-19 - Tweenager / Teenager" }
]
},
'plugins': ["checkbox", "wholerow", "sort"],
'checkbox': { "three_state": true }
});