jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Tree › Removing tree item – empty divs
Tagged: jquery tree
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 3 months ago.
-
Author
-
While adding item to tree you wrap ‘li’ element with ‘div’:
var el = $('<div>' + html + '</div>)'
Why don’t you remove those divs while removing tree item.
There are empty divs left.Hi lopez306,
1. We do not wrap LI tags with DIV tags. The Tree’s structure is always UL with LI tags. The Tree Item’s title is a DIV tag wrapped around the item’s title, not the LI tag.
2. When an item is removed, its associated LI tag is removed including all of the LI tag’s children.If you experience a different behavior on your side, please provide a sample which demonstrates it and step by step instructions. I also suggest you to take a look at this topic: http://www.jqwidgets.com/community/topic/welcome-to-jqwidgets-forum, because it describes the process of reporting an issue.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comjQWidgets: 2.6.1
jQuery: 1.9.0
Browser: all of them1. Select any existing tree item
2. Click first button
3. Investigate DOM – you will notice there is li element wrapped with div
4. Select newly created tree item
5. Click second button
6. Investigate DOm – you will notice there is empty div.<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>JQWidgets</title> <link rel="stylesheet" href="jqwidgets/styles/jqx.base.css?v=2.6.1" type="text/css" /> <link rel="stylesheet" href="jqwidgets/styles/jqx.energyblue.css?v=2.6.1" type="text/css" /> <script type="text/javascript" src="js/ext/jquery-1.9.0.js"></script> <script type="text/javascript" src="jqwidgets/jqxcore.js?v=2.6.1"></script> <script type="text/javascript" src="jqwidgets/jqxbuttons.js?v=2.6.1"></script> <script type="text/javascript" src="jqwidgets/jqxscrollbar.js?v=2.6.1"></script> <script type="text/javascript" src="jqwidgets/jqxpanel.js?v=2.6.1"></script> <script type="text/javascript" src="jqwidgets/jqxtree.js?v=2.6.1"></script> <script type="text/javascript"> $(document).ready(function () { $('#jqxTree').jqxTree({ height: '400px', hasThreeStates: true, width: '330px', theme: 'energyblue' }); $('#btn1').bind('click', function () { var selectedItem = $('#jqxTree').jqxTree('getSelectedItem'); if (!!selectedItem) { $('#jqxTree').jqxTree('addTo', { label: 'Item' }, selectedItem.element); } }); $('#btn2').bind('click', function () { var selectedItem = $('#jqxTree').jqxTree('getSelectedItem'); if (!!selectedItem) { $('#jqxTree').jqxTree('removeItem', selectedItem.element); } }); }); </script></head><body class='default'> <div id='jqxWidget'> <div style='float: left;'> <div id='jqxTree' style='float: left; margin-left: 20px;'> <ul> <li>Home</li> <li>Solutions</li> <li>Products</li> </ul> </div> </div> </div> <input type="button" id="btn1" value="add tree item to selected item" /> <input type="button" id="btn2" value="remove selected tree item" /></body></html>
Any news here ??
Hi lopez306,
With the additional explanation from your side, we replicated the behavior. Thank you about that. In the next version, the DIV tags from dynamically added tree items, will be removed when these items are dynamically removed.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.