Using a Repeater for Multi-level Accordion Navigation?

It’s possible to do this using a system of nested item id’s.
If an item is on the second level, parentid = the id of the parent (top menu item).
If an item is on the third level, grandparentid = the id of the grandparent (top menu item).

The basic idea is:
When the user clicks on an item:

  • Set “expanded = y” for that item
  • Set “parentexpanded = y” for any items where the Targetitem.parentid == Item.id
  • Set “grandparentexpanded = y” for any items where Targetitem.grandparentid == Item.id

Then, add a filter to the repeater OnLoad event that shows:

  • All top-level menu items
  • Second-level menu items where the main menu is expanded
  • Third level menu items where the main menu is expanded AND the second-level menu is expanded

This is necessary if you want the inner subfolders to STAY expanded (or closed) when you close and open the main menu item. If you don’t need those inner folders to remember whether they were open or closed, you can probably simplify this.

Here’s a sample file:
leftNavRepeater_modified.rp (82.6 KB)

1 Like