Lazy Loading in dynatree

时间秒杀一切 提交于 2020-01-16 11:16:21

问题


In this component http://wwwendt.de/tech/dynatree/index.html

under 5.4 Loading child nodes on demand ('lazy loading')

it seems that the only way to load the tree nodes in a lazy manner is to grab them from web service. What if I want to grab the nodes from a data structure?

such as:

onLazyRead: function(dtnode){

                dtnode.appendAjax({
                   //url: "sample-data2.json" 
                   //grab the nodes here from array
                });
  }

Any advice? Another question: when onLazyRead is executed, does the whole tree get re-rendered again?


回答1:


You could use

dtnode.addChild(dict);

instead of

.appendAjax(...)

In either case, only the changed nodes should get rendered.

dict must be formatted like the JSON response. You can als generate dict from a given tree or node using the toDict() method.



来源:https://stackoverflow.com/questions/3026267/lazy-loading-in-dynatree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!