I have a Multi-levelled PanelBar. If the user opens up into, say level3 and then closes the root, I want to collapse all child panels, so that when they open from the root again all children are collapsed.
I have implemented this which seems to work - I post it incase it will help others. I need this because I have several levels of information and it just gets very cluttered and the user gets a little bit "lost" during navigation!
<script type="text/javascript">
functionOnClientItemCollapse(sender, eventArgs) {
varitem = eventArgs.get_item();
if(item.get_level() != 0) {
return;
}
varchildItems = item.get_items();
varchildItemsArray = childItems.toArray();
if(childItemsArray) {
for(vari = 0; i < childItemsArray.length; i++) {
childItemsArray[i].collapse();
}
}
}
</script>
I am building the PanelBar programmatically so add the OnClientItemCollapse definition in the code behind.