简体   繁体   中英

How to re-initialize fancytree?

I have to reinitialize a fancytree in dependence of the choosen dropdown option.

Every time I change the option, I call the function getTree() in wich I initialize

$("#tree").fancytree({.....});

The problem is that the tree tries to load the data also from the previous selection because it's already initialized, so I have to re-initialize it in some way (I want to render new tree every time I change the dropdown option).

Somebody could help me? Thanks.

You could reload the tree with new source

tree.reload({
  url: ...
})

如果您不使用lazyLoad,也可以更新源选项(无需重新加载树)

$("#tree").fancytree("option", "source",[{…},{…},…])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM