OdinaSpb / jstree

Automatically exported from code.google.com/p/jstree
0 stars 0 forks source link

Opening the node gets stuck in progressive render #989

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Here is the relevant block of code that causes the hanging:
...
                $(nodeIdsToClose).each(function() {
                    $('#tree').jstree("close_node", $('#tid'+this), false); 
                });
                $(nodeIdsToOpen).each(function() {
                    $('#tree').jstree("open_node", $('#tid'+this), false, false); 
                });

                countJsreeNodeOperations = nodeIdsToClose.length + nodeIdsToOpen.length;
                var thisNodeId = (thisNodeParentIds.length>0 ? thisNodeParentIds[thisNodeParentIds.length-1] : '') + '_' + id;

                var interval = setInterval( function(){
                    if(countJsreeNodeOperations==0) {
                        $('#tree').jstree("deselect_all");
                        $('#tree').jstree("select_node", $('#tid'+thisNodeId));
                        var name = $.trim($('#tid'+thisNodeId).children('a').text());
                        $('#tid'+thisNodeId).html( $('#tid'+thisNodeId).html().replace(name,'<span class="tree-highlight">'+name+'</span>') );
                        adjustTreeDimensions();
                        clearInterval(interval);
                    }
                }, 100 );
...
The function running this code block is called externally as outside-of-tree 
request comes in to open up specific tree node. Logic runs to evaluate which 
nodes are currently open and close everything except the nodes that will remain 
open once our parameter node is open (i.e. parents of parameter node). 
Open_node loop runs normally on the nodes that are already loaded with 
load_node_json() but once it hits the one not yet loaded it gets stuck.

What is the expected output? What do you see instead?
Expect the node to open, instead see spinner that keeps spinning. Please see 
screenshot

What version of the product are you using? On what browser?
Mac OSX Lion, Chrome 15.0.874.121, FF 3.6.24.

Please provide any additional information below.
I ran step-by-step debugging and found the place inside load_node_json() where 
block of logic is bypassed based on some complex condition checking. As a 
workaround if I am adding an extra parameter to load_node_json() and force this 
block execution via adding an extra call to load_node_json in the above block 
before opening it this problem is getting fixed. Please see attached diff for 
the reference.

Original issue reported on code.google.com by pshrabst...@5amsolutions.com on 13 Dec 2011 at 4:48

Attachments:

GoogleCodeExporter commented 9 years ago
Jstree version is 'Pre 1.0 fixed'

Original comment by pshrabst...@5amsolutions.com on 13 Dec 2011 at 5:08