EasyUI Forum
May 15, 2024, 01:06:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Huge JSON tree  (Read 7102 times)
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« 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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: October 07, 2014, 09:29:18 AM »

Please try to use the async tree.
http://www.jeasyui.com/tutorial/tree/tree2.php
Logged
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« Reply #2 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.


 
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 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
Logged
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« Reply #4 on: October 08, 2014, 02:03:01 AM »



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

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

$('#myTree').tree({loadFilter: myLoadFilter,....rest of parms....})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!