Loading ...
Sorry, an error occurred while loading the content.

menubar - not all items need submenus - possible to create submenus w/ script?

Expand Messages
  • cbaringe
    I am building a website nav menubar. I have successfully created it using markup, but am now seeing a flash as the submenus are rendered, before they align
    Message 1 of 2 , Sep 2, 2008
    • 0 Attachment
      I am building a website nav menubar. I have successfully created it
      using markup, but am now seeing a "flash" as the submenus are
      rendered, before they align correctly. Searching has revealed advice
      to render the submenus with script to speed the page load. I assume
      this "flash" problem will be solved, since the submenus will not be
      rendered until the user requests them.

      However, I have 10 items in the menubar, but only four of those items
      need submenus. Is it possible to use script to render the submenus
      when only a subset of the menubar items need them? If so, can you
      point me to an example?

      Thanks!
      Cheryl
    • cbaringe
      Okay, I ve solved this, thought I would document it here for anyone else facing the same learning curve. To attach menu items to just a subset of a menubar,
      Message 2 of 2 , Sep 3, 2008
      • 0 Attachment
        Okay, I've solved this, thought I would document it here for anyone
        else facing the same learning curve. To attach menu items to just a
        subset of a menubar, find the following bit of code:

        oMenuBar.subscribe("beforeRender", function () {
        if (this.getRoot() == this) {
        this.getItem(3).cfg.setProperty("submenu",
        aSubmenuData[0]);
        this.getItem(4).cfg.setProperty("submenu",
        aSubmenuData[1]);
        this.getItem(8).cfg.setProperty("submenu",
        aSubmenuData[2]);
        }
        });

        As you can see from the getItem parameters, I've set submenus on the
        fourth, fifth, and ninth
        menu items within the menubar.

        HTH someone!
        Cheryl
      Your message has been successfully submitted and would be delivered to recipients shortly.