Menu

#3 Expansion on start with Query parameters

open
None
5
2002-04-28
2002-04-23
IH
No

Hi,

I was wondering how the expansion worked and how I can
have the menu automatically expand to a given item on
startup.

Thanks,

IH

Discussion

  • Morten Wang

    Morten Wang - 2002-04-28

    Logged In: YES
    user_id=141897

    I'm not sure what exactly you mean by "expansion". If
    you're wondering what exactly happens when you try to expand
    a submenu it's a call to function MTMSubAction() through the
    onclick-event of the item's link. This in turn changes the
    item's .expanded property as needed, then it sets the
    MTMClickedItem variable so the submenu can be shown as
    expanded/closed, and lastly it checks if it needs to call
    MTMDisplayMenu() to refresh the menu display.

    If you want a specific submenu expanded by default, just set
    the second argument of makeLastSubmenu()/makeSubmenu() to
    'true', as mentioned in the install guide.

    If you set MTMCookieName it'll also store the menu state in
    a cookie so it's expanded when the user returns.

     
  • Morten Wang

    Morten Wang - 2002-04-28
    • assigned_to: nobody --> nettrom
     
  • IH

    IH - 2002-04-28

    Logged In: YES
    user_id=124000

    Here is an example, OpenTreeMenu.html?item=1-4-4

    This should open the treemenu found in the html file and
    expand where the item 1-4-4 exists in the tree.

    So if my tree consists of the following data

    1
    1-1
    1-1-1
    1-1-2
    1-1-3
    1-2
    1-2-1
    1-2-2
    1-2-3
    1-3
    1-4
    1-4-1
    1-4-1-1
    1-4-2
    1-4-3
    1-4-4

    then the visiable tree would be

    1
    1-1
    1-2
    1-3
    1-4
    1-4-1
    1-4-2
    1-4-3
    1-4-4

    with 1-4-4 highlighted. So I guess what you are telling me
    is that by setting the 2nd argument in makeSubmenu(1-4-4,
    x) to be true in the onload that this menu will be expanded
    to this point?

    Thanks for the response!

     
  • Morten Wang

    Morten Wang - 2002-04-28

    Logged In: YES
    user_id=141897

    Yep, that would be correct.
    http://www.treemenu.com/install-guide/the-menu.shtml has the
    details on the arguments that makeSubmenu() &
    makeLastSubmenu() take.

     
  • IH

    IH - 2002-05-07

    Logged In: YES
    user_id=124000

    Actually there seemed to be functionality already built in
    such that if the text frame url was the same as one of the
    items in the toc then the toc would expand to that item.
    My problem was that my query parameters were different on
    the url between the text frame and the urls in the toc
    frame thus making the string compare false.

     
  • Jan van Santbrink

    Logged In: YES
    user_id=776841

    Hi,

    We want to expand the tree on a mouseclick, when the user
    clicks on a leaf we like to expand the tree by reading the
    items from the database (the user must think it is already a
    subnode based on the apperance). What kind of calls must
    we make. The menu item must contain the database key
    based on event the items are populated and the menu must
    be redrawn.
    Any help appreaciated.

    John

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.