Question

I'm trying to recharge my treeview using dynatree and expand in the same place where I left off, but I can not. I'm carrying it whole, making a query in mvc using oracle and returning a shortlist dynatree with the keys already defined.

My code:

$("#tree").dynatree({
   selectMode: 3,
   clickFolderMode: 3,
   initAjax: {
   type: "POST",
   url: "/controller/GetTree"
 }
});

To recharge the record insert via ajax mvc, the only way to upgrade is to give reload the treeview, so:

$("#tree").dynatree("getTree").reload();

then try to expand or getnodebykey use, but still does not work

$("#tree").dynatree("getRoot").visit(function (node) {
 node.expand(true); 
});

Thanks

Was it helpful?

Solution

There is a cookie persistence functionality or you can do it with something like tree.selectKey(val).Expand(); where val is the key of what you need to expand.

You can also use the generateIds:true; option when creating the tree so you can access directly the nodes if know the id and can use jquery selector.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top