Saturday, 30 January 2010

smartGWT MenuBar - this.menus is undefined error

When you are attempting to add a smartGWT MenuBar to your screen, usually at system startup. If you get an error like this:

  com.google.gwt.core.client.JavaScriptException: (TypeError): this.menus is undefined

then check that you have used setMenus in when you first instantiate the menu bar. For example:
            MenuBar menuBar = new MenuBar();
           
            menuBar.setMenus(myFirstMenu,mySecondMenu);
           
            menuBar.setVisible(true);
            menuBar.setKeepInParentRect(false);

            RootPanel.get("menuPanel").add(menuBar);       


It is possible to use the add functions to add members and menus, but the underlying JavaScript needs a setMenu call to have the array that stores the menus initialised.

2 comments:

  1. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read. Best network interview questions service provider.

    ReplyDelete
  2. Hubs is the best manufacturing answer for geometrically advanced and cosmetically demanding elements, requiring world-class floor finishes. Hubs offers a really fast and highly reliable service for extensive range|a variety} of capabilities, even for advanced designs or particular supplies. With hundreds of producers in our network, we have a really broad range of manufacturing capabilities and support both one-off prototyping and low-volume manufacturing. We delight ourselves on being the go-to manufacturer for geometrically advanced elements or highly cosmetic elements. All designs are 3D printable and may Winter Hats be shared and viewed on any gadget.

    ReplyDelete