Search code examples
javascriptjqueryjstreefancytreejqtree

is objectbinding possible with any javascript tree view like fancytree, jstree, jqtree?


currently i am using fancytree for tree view

i want to bind an object to the fancytree

 source: [
    {title: "Node 1", key: "1"},
    {title: "Folder 2", key: "2", folder: true, children: [
      {title: "Node 2.1", key: "3"},
      {title: "Node 2.2", key: "4"}
    ]}
  ],

..like source: my_object

and if i change any tree node that will automatically reflect in the object is it possible with fancytree ?

any other javascript tree view plugin can possible this ?


Solution

  • This reference would help you : http://wwwendt.de/tech/fancytree/doc/jsdoc/FancytreeNode.html

    This method : fromDict(dict) is said to update node data , so in your case you can use dynamic object , but always have to update node data , to reflect changes to current tree.

    Also check this method toDict(recursive, callback) , this converts the node to plain object , so you can modify it ( if you dont want to use the provided API ) , though the api is also compatible with this method.