EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: PaulMcGuinness on October 06, 2014, 07:46:14 AM



Title: Huge JSON tree
Post by: PaulMcGuinness on October 06, 2014, 07:46:14 AM
Hi,

I'm loading a very large JSON tree which is properly formatted into the tree control using the following line:-

$('#' + divId).tree('loadData',amTreeSource);

The fetching is ok, as is the sorting of the child nodes within the JSON data, but this can freeze the browser and throw up a 'script not responding' message.

How can I take this large JSON object and asynchronously pass it to .tree()  ?

Cheers,

Paul


Title: Re: Huge JSON tree
Post by: jarry on October 07, 2014, 09:29:18 AM
Please try to use the async tree.
http://www.jeasyui.com/tutorial/tree/tree2.php


Title: Re: Huge JSON tree
Post by: PaulMcGuinness on October 07, 2014, 11:50:40 AM
Unfortunately I can't use that method as the data is being returned from a 3rd party platform.

I have the entire tree as a JSON object - could you perhaps suggest a method for walking the JSPN object and asynchronously inserting the nodes via setTimeout() ?

There is approx. 10 nodes off the root, and ideally I'd like to async add each of these (and their children) - this would solve the issue for me.


 


Title: Re: Huge JSON tree
Post by: jarry on October 07, 2014, 06:45:21 PM
This example shows how to get full hierarchical tree data but lazy load nodes level by level.
http://www.jeasyui.com/demo/main/index.php?plugin=Tree&theme=default&dir=ltr&pitem=Lazy%20Load%20Tree%20Nodes


Title: Re: Huge JSON tree
Post by: PaulMcGuinness on October 08, 2014, 02:03:01 AM


This is exactly what I was looking for - Many thanks!   :)

For anyone else having the same issue, I simply implemented it using this method:-

$('#myTree').tree({loadFilter: myLoadFilter,....rest of parms....})