在AciTree插件中获取特定节点数据

时间:2016-08-10 21:26:53

标签: jquery acitree

我为aciTree插件提供了以下JSON源,并希望检索节点"tree-data"的值。我没有在文档中看到任何特定功能。有什么想法吗?

[{
    "id": "-",
    "label": "100 - Environment",
    "inode": true,
    "open": false,
    "checkbox": false,
    "branch": [{
        "id": "M-CSP-HID-1301-01W8",
        "label": "100.10.10 Dangerous Fauna",
        "inode": true,
        "open": false,
        "checkbox": true,
        "tree-data": "M-CSP-HID-1301-01W8#^Dangerous Fauna#^Low",
        "branch": [{
            "id": "-",
            "label": "Coming into contact (ingestion, bites, stings, injection) with potentially dangerous animals that include - Invertebrate - Protozoa (one celled organisms - amoeba), Arachnids (Spiders, scorpions), Insects (mosquitoes, fire ants, bees), Crustaceans (Crabs), Annelids (Leeches), Echinoderms (Sea Urchin), Scyphozoa (Jelly Fish): Vertebrate - Fish (Shark, piranha, stingray), Amphibians (dart frogs), Mammals (Cows, Moose, Whales, etc.), Rodents (Rats, mice, etc.), Primates (Apes) , Reptiles (snakes, alligator, etc.), Birds (Raptors)",
            "checkbox": false
        }]
    }
  ]

1 个答案:

答案 0 :(得分:1)

非常简单,

 var itemData = api.itemData(item);
 tnode=itemData._nodedata;
  

“tree-data”重命名为_nodedata。