| Page 1 of 1 | [ 3 posts ] |
|
Hi All,
I've a problem in my application, where we are using Treeview with Drag drop support. Drag drop works fine as long as I do drag drop operation continuously. But When I sit idle for 2-3 minutes, then the nodes which are yet to be expanded, their children won't support drag drop operation. Sample Html file is: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Drag Drop Stops after 2-3 minutes</title> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0r4/build/fonts/fonts-min.css"> <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/animation/animation-min.js&2.8.0r4/build/treeview/treeview-min.js&2.8.0r4/build/dragdrop/dragdrop-min.js"></script> </head> <body class="yui-skin-sam"> <h4>Problem</h4> <p style="color:red"> If you expand a node try do drag drop it children nodes immedietly, then it works, and if you wait for around 2-3 minutes, and then expand a node, now it's children won't support drag drop </p> <br><br> <div id="treeDiv1"></div> <script type="text/javascript"> var Dom = YAHOO.util.Dom; var Event = YAHOO.util.Event; var DDM = YAHOO.util.DragDropMgr; var tree = null; var treeInit = function() { tree = new YAHOO.widget.TreeView("treeDiv1"); // Create a tree with 15 main nodes, each having 15 children for (var k = 0; k<15; k++) { var tmpNode = new YAHOO.widget.TextNode("parent "+k, tree.getRoot(), false); new YAHOO.util.DDProxy(tmpNode.labelElId); for (var j = 0; j<15; j++) { var tmpNode2 = new YAHOO.widget.TextNode("*******child****-"+j, tmpNode, false); new YAHOO.util.DDProxy(tmpNode2.labelElId); } } tree.draw(); }; YAHOO.util.Event.onDOMReady(treeInit); </script> </body> </html> I've used TextNode in this example, but I've also tried with HTMLNode without any success. Please let me know, if you need more information. Please provide your views. Thanks Pmaks |
lou
|
i test your code,but the tree is not the same as the examples on YUI treeview component.there is no ico imag on your tree.and i get the bug you provided,after some minutes,i can not operate the drag and drop on the tree.
|
|
The tree branches are not drawn until their parents are expanded. Many YUI methods, when provided with either an element or an ID will fail if the element is not present or, if provided with an ID, they will launch a timer and search for that element every so often until found. This allows for some delay in the drawing of an element. However, the time consumes some resources so after a while the search will be dropped.
Basically, this is what allows you to set the ddproxys on the top level of branches. You are setting a DDProxy on an element that you positively know it is not there, since you have not called tree.draw (which is deprecated, BTW: use render()). The delayed retry that YUI provides spares you trouble at that level. You can either set the renderHidden property on node creation: http://developer.yahoo.com/yui/docs/YAH ... nderHidden so non-expanded branches will have its children rendered or you can listen to the expandComplete event, which will tell you which node has just been expanded and check its children to see which nodes have DDProxies missing. expandCompelte will fire on the first expand and on any later expand so you will want to add a custom property to each node to mark it as 'proxied' or not. The later is more in line with the whole idea of delaying taking resources on nodes not yet (and perhaps never) expanded. Besides, by the time you get that event, you know the HTML markup for the node has been drawn. |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group