Home > front end >  Easy UI drop-down tree, generating background json spend time is too long
Easy UI drop-down tree, generating background json spend time is too long

Time:10-24

Want to use easy UI generated provinces of the nation's drop-down tree
For the tree drop-down required json format is more special, so I used a recursive implementation, as provinces in the country too much, need to spend seven or eight seconds at a time, do you have any good solution?
Or should not use recursion, the json string should be how to spell it?
Haven't graduate, very vegetables, hope you Daniel can speak a little bit in detail, thank you
The code
 public List GetCityTree () {
List TreeList=cityService. GetCityTreeNode (0);
Return getChildrenNodeList (treeList);
}


/* *
* recursive top-level node
* @ param treeList
* @ return
*/
Private List GetChildrenNodeList (List TreeList) {
For (Map The map: treeList) {
The Object pid=map. Get (" id ");
List ChildrenNodeList=cityService. GetCityTreeNode (Integer. ParseInt (String. The valueOf (pid)));
if(! ChildrenNodeList. IsEmpty ()) {
GetChildrenNodeList (childrenNodeList);
The map. The put (" state ", "closed");
The map. The put (" children ", childrenNodeList);
}
}
Return treeList;
}
  • Related