Title: TreeGrid - All nodes are expanded after loadData call Post by: amir-t on July 14, 2013, 01:30:19 AM Hi,
When i calling loadData with the full hierarchic tree data (with about 3000 nodes, 8 levels) all the nodes are expanded after loaded to the tree, automatically, which probably cost in performance because its taking about 1:30 minutes to load this full tree. I really need some help with some manners : 1. Is there any way to improve the loading performance ? 2. How can i load the full tree data while telling the TreeGrid not to expand its nodes after load, but to keep them collapsed of course. (calling collapse all after loadData call is not a solution, im looing for some setting to tell the treeGrid not to expand nodes at all but just load them to the treeGrid). Thanks in advance Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: stworthy on July 15, 2013, 08:31:18 PM Please refer to this lazy loading tutorial http://www.jeasyui.com/tutorial/tree/treegrid5.php.
Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: amir-t on July 16, 2013, 11:12:07 AM Thanks.
But there is still another problem, I've noticed, that the lazy loading tutorial is related only to a full hierarchic treegrid data, only when the data structure includes the 'children' property to each parent's node. On our case, we're using a treegrid data which uses a flat structure of rows, where each child row has '_parentId' property that point to its parent row id. We actually need to load a tree data in this kind of structure: Code: [{"id":1,"name":"All Tasks","begin":"3/4/2010","end":"3/20/2010","progress":60,"iconCls":"icon-ok", "state":"closed"}, Instead of this structure: Code: { When we used the loadData method to fill the treeGrid with the flat structure (the first example), for some reason, its doesn't consider the _parentId property and adds all the nodes in the root level without the correct hierarchic relations. We tried to use a similar Json as the example of "TreeGrid Actions" on your site, according to your following json: http://www.jeasyui.com/demo/treegrid/treegrid_data2.json Hope you'll be able to assist us on that manner, Regards. Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: stworthy on July 16, 2013, 07:02:21 PM The 'loadFilter' provide the opportunity to let users change the source data to standard hierarchic data. Please try the following 'loadFilter' function.
Code: function myLoadFilter(data,parentId){ Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: amir-t on July 17, 2013, 02:16:47 AM I'll try it, hopes it works.
However. I still don't understand some important manner, in your demo example of the TreeGrid- "TreeGrid Actions", you used a full hierarchic json: http://www.jeasyui.com/demo/treegrid/treegrid_data2.json , and the data has loaded in the correct hierarchical relations, but you didn't used there any 'loadFilter' method there. So how in that example you managed to load the flat tree data as hierarchical without using the loadFilter method? Maybe the loadFilter is called in your inner code in case the full data is set at the url property? Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: stworthy on July 17, 2013, 08:16:29 AM The 'loadFilter' is the public function to allow users to change their source data to accepted data. It is not the only one solution. Another solution is to extend the treegrid view.
Code: var myview = $.extend({},$.fn.treegrid.defaults.view,{ Now apply this treegrid view. Code: $('#tg').treegrid({ Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: amir-t on July 17, 2013, 09:38:48 AM I see. nice solution indeed :)
Is this how use implement your following demo example: http://www.jeasyui.com/demo/main/index.php?plugin=TreeGrid&theme=default&dir=ltr&pitem=TreeGrid%20Actions Because in the source code, i don't see any use of 'loadFiler' or setting the view property (like view: myview) of the treeGrid, when its being created. In your demo example, the treeGrid is created as follows: Code: <table id="tg" class="easyui-treegrid" title="TreeGrid Actions" style="width:700px;height:250px" Without using 'loadFilter' or any specific loading or extend logics, While the input json is a flat tree representation (by using the _parentId property): http://www.jeasyui.com/demo/treegrid/treegrid_data2.json Title: Re: TreeGrid - All nodes are expanded after loadData call Post by: zolotoy on July 27, 2015, 06:28:57 AM <Without using 'loadFilter' or any specific loading or extend logics,
That's exactly the same question I have. How does your sample work without any custom code? |