I am testing Jquery Treeview and finding a bug which I cannot figure out.
What seems to be happening is that the toggle is getting messed up on the first, second level nest.
To test...go to the fiddle, click Collapse All then Expand All and you'll see the node which does not expand properly, but it's + icon turns into a - icon so that's correct at least.
Is this a known bug? It happens on their demo too.
I know there are more recent plug-ins claiming to do the same thing but I like the simplicity of this (assuming I can iron out this bug that is!)
I'm pretty sure the bug is in the toggler and guess its not recursing properly:
// handle toggle event
function toggler() {
$(this)
.parent()
// swap classes for hitarea
.find(">.hitarea")
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
// swap classes for parent li
.swapClass( CLASSES.collapsable, CLASSES.expandable )
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
// find child lists
.find( ">ul" )
// toggle them
.heightToggle( settings.animated, settings.toggle );
if ( settings.unique ) {
$(this).parent()
.siblings()
// swap classes for hitarea
.find(">.hitarea")
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
.find( ">ul" )
.heightHide( settings.animated, settings.toggle );
}
}
this.data("toggler", toggler);