PDA

View Full Version : Drill Down Menu Trigger Function on Back



treis
04-12-2011, 04:43 AM
1) Script Title: Drill Down Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/drilldownmenu.htm

3) Describe problem:

I am using the DD Menu as sort of a database navigation tool. There are two panes displaying navigation items and a 3rd pane displaying results. For example, if the panes were used to navigate types of pictures the three frames would be:

Left: Animals\Puppies, Kitties, Turtles
Middle: Activities\Eating, Playing,
Right: List of links to pictures.

So if a user picked Puppies and Eating, the right would show links to pictures of puppies eating. I have that all working, the only problem is that I have no way to clear the selection. To continue my example, when a user hits back after selecting Activities -> Eating, my list doesn't update.

What I need is a way to trigger a function on the back click. Any ideas how to do that?

ddadmin
04-12-2011, 07:51 PM
Try the below modified .js file. It lets you define a custom onnavback() function, which is executed each time the user navigates back within the drill down menu. For example, something like:


<script type="text/javascript">

var mymenu=new drilldownmenu({
menuid: 'drillmenu1',
menuheight: 'auto',
breadcrumbid: 'drillcrumb',
persist: {enable: true, overrideselectedul: true}
})

mymenu.onnavback=function(){
alert(this.currentul)
}

</script>

The code in red is new, whereby this.currentul used within the function will give you the index of the destination UL the user is navigating back to relative to the other ULs within the menu when flattened. The top UL will always return 0, the 2nd UL return 1 etc.

treis
04-14-2011, 06:41 PM
Wow thanks for the quick response. I'll give that a try and let you know how it all turns out.