jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Tree › Collapse all possible bug
Tagged: e.data("timer").show != null, jqxtree
This topic contains 5 replies, has 5 voices, and was last updated by iamswain 8 years ago.
-
Author
-
Hi I am testing the jqxTree widget (I downloaded version 3.7.1 today) I have possibly found a bug on ‘Collapse All’ method. I have a tree with 5 ‘root’ items, the first three have children, the fourth doesn’t, the last does. If I do a collapse all, I get an error saying “Cannot read property ‘show’ of undefined”. Moreover, the last tree item (after the one that has no children) does not get collapsed. I deminified the source code of jqx-all.js and found out that in the _collapseItem function there is this line of code (line 41492 of jqx-all.js deminified)
if (e.data("timer").show != null) {
but this does not check if e.data(“timer”) is defined or not, which in my case leads to an error. So I had modified it to
if (e.data("timer") && e.data("timer").show != null) {
I had also changed line 41520, adding a similar check
if(e.data("timer"))
inside the same function. It now works flawlessly on my side.
I saw that on the _expandItem method this ‘if null’ check exists:
if ((e.data("timer")) != null && e.data("timer").hide != null) {
on line 41545, whereas this is not the case in the expand all method. I am not 100% sure if this is a bug or just a problem on my side.
If it was a bug, I hope my change may help. (by the way, is there a ‘submit a bug’ feature on the website? I couldn’t find it)
Best regards
MirkoHello Mirko,
Here is an example with 5 root items and 4 of the 5 items have children items and it works correctly on our side(using jQWidgets v3.7.1). If you still have an issue, then provide a full sample which demonstrates it.
<!DOCTYPE html> <html lang="en"> <head> <title></title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxtree.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#jqxTree').jqxTree({ height: '400px', width: '300px', theme: 'energyblue' }); $("#jqxbutton").jqxButton({ theme: 'energyblue', width: 200, height: 30 }); $('#jqxbutton').click(function () { $("#jqxTree").jqxTree('collapseAll') }); }); </script> </head> <body class='default'> <div id='jqxTree'> <ul> <li item-selected='true' item-expanded='true'>Item 1 <ul> <li>SubItem 1</li> </ul> </li> <li item-expanded='true'>Item 2 <ul> <li>SubItem 1</li> <li>SubItem 2</li> </ul> </li> <li item-expanded='true'>Item 3 <ul> <li>SubItem 1</li> <li>SubItem 2</li> <li>SubItem 3</li> </ul> </li> <li>Item 4</li> <li item-expanded='true'>Item 5 <ul> <li>SubItem 1</li> <li>SubItem 2</li> </ul> </li> </ul> </div> <input type="button" style="margin: 10px;" id="jqxbutton" value="Collapse all items" /> </body> </html>
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/Thank you for your reply. Unfortunately my jqxTree code initialization is quite complex and it is nested in some modules of my web app so I can’t provide you with a simple ‘copy-paste’ sample of my code. Plus, my tree is built with JSON data. Thanx anyway, the change I had made to the source code works fine anyway.
hi,
i found a little bug when i collapse all
http://runsense.re/ in clearchec baczoom button!!
when i select first Item or last item in start,
and i click,
all diseapear, or
tree never remake it’s Original form!
Maybe exist a manner for, but not found.Thanks for ur reply
Hi runsense,
In our demos we use uncheckAll about these purposes and it works fine.
Please look at the demo.If you can localize the problem generated this error send a fiddle/jsEditor link an we will investigate it.
Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.