angular-tree-control
angular-tree-control copied to clipboard
Angular Tree control multiselection manual nodes selected not working
I am using angular tree control plugin for folder tree structure. Everything is working fine. I am using multiselection option.
When i am fetching the data already selected, I need to maintain the selection status of the nodes.
for fetching data I am using below line
$scope.selectedNodes = [$scope.jsonObject[0],$scope.jsonObject[1],$scope.jsonObject[2]];
But those 3 nodes are not selected. I tried with single selection, it is working fine. But multiselection is not working.
`
$scope.treeOptions = {
nodeChildren: "children",
multiSelection: true,
dirSelectable: true,
injectClasses: {
ul: "a1",
li: "a2",
liSelected: "a7",
iExpanded: "a3",
iCollapsed: "a4",
iLeaf: "a5",
label: "a6",
labelSelected: "a8"
}
};
$scope.jsonObject=
[
{ "id" : 1, "name" : "Metric1", "children" : [
{ "id" : 12, "name" : "Option1", "children" : [
{ "id" : 1211, "name" : "Sub Option1", "children" : [] },
{ "id" : 1212, "name" : "Sub Option2", "children" : [] }
]},
{ "id" : 13, "name" : "Option2", "children" : [
{ "id" : 1311, "name" : "Sub Option1", "children" : [] },
{ "id" : 1312, "name" : "Sub Option2", "children" : [] }
]}
]}
,
{ "id" : 2, "name" : "Metric2", "children" : [
{ "id" : 22, "name" : "Option1", "children" : [
{ "id" : 2211,"name" : "Sub Option1", "children" : [] },
{ "id" : 2212,"name" : "Sub Option2", "children" : [] }
]},
{ "id" : 23, "name" : "Option2", "children" : [
{ "id" : 2311, "name" : "Sub Option1", "children" : [] },
{ "id" : 2312, "name" : "Sub Option2", "children" : [] }
]}
]}
];`