Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    setAutoDismiss() feature does not work in MENU

    hi,

    I'm struggling with customized MENU and the very last thing to do is to prevent window automatically dismiss after selection (multiple one in one "menus' session" is a key feature).

    I did set autoDismiss to FALSE, but menu still closes instantly when item has been selected.

    thanks in advance,
    pieroog

    #2
    what I have spotted is that, the LISTGRID upon which MENU is built, has GROUPED entries. when I disable grouping, setAutoDismiss() works without any problem.

    any ideas?
    Last edited by pieroog; 23 Nov 2009, 03:21.

    Comment


      #3
      I seem to have stumbled over the same problem trying to customize the ListGrid header menu. I added a test submenu which was supposed to behave the same way the "Columns" submenu, i.e. provide a way to select a subset of the listed values. The menu closes as soon as I click on any of the options.

      This is a snippet from my extension of the ListGrid class:

      Code:
      	
      	@Override
      	protected MenuItem[] getHeaderContextMenuItems(Integer fieldNum) {
      		MenuItem[] inherited = super.getHeaderContextMenuItems(fieldNum);
      		List<MenuItem> items = new ArrayList<MenuItem>();
      		items.addAll(Arrays.asList(inherited));
      		MenuItem submenuItem = new MenuItem("submenu item");
      		Menu submenu = new Menu();
      		submenu.setTitle("submenu");
      		MenuItem testSubItem = new MenuItem("test subitem");
      		MenuItem testSubItem2 = new MenuItem("test subitem 2");
      		for (MenuItem mi : Arrays.asList(testSubItem, testSubItem2)) {
      			final String title = mi.getTitle();
      			mi.setCheckIfCondition(new MenuItemIfFunction() {
      				@Override
      				public boolean execute(Canvas target, Menu menu, MenuItem item) {
      					return true;
      				}
      			});
      			mi.addClickHandler(new ClickHandler() {
      				@Override
      				public void onClick(MenuItemClickEvent event) {LOG.debug(Util.concat("clicked ", title, "!"));}
      			});
      			submenu.addItem(mi);
      		}
      
      		submenuItem.setSubmenu(submenu);
      		submenu.setAutoDismiss(false);
      		submenu.setSelectionType(SelectionStyle.MULTIPLE);
      		items.add(submenuItem);
      		inherited = items.toArray(new MenuItem[0]);
      		return inherited;
      	}

      Comment


        #4
        Same exact problem

        What I noticed is that in the javadocs it says that the value must be set to true for setAutoDismiss to work. However, I've tried it with both false and true values, and it doesn't work either way.

        Comment


          #5
          I'm using the June 4th nightly build and this is still not working. Is there a workaround or ETA for a fix?

          Comment


            #6
            Jay, what are you seeing, that autoDismiss does not work at all (this appears to be an erroneous report) or that autoDismiss is not working in some specific circumstance? If the latter, can you show test code?

            Comment


              #7
              What I'm seeing is that it doesn't work at all. The menu I've created is an alternative to the standard column chooser menu (with hierarchical arrangement of some fields into submenus). So the clickHandler for the menu items calls showField() or hideField() on the underlying grid fields. Could that have something to do with it? The behavior I'm seeing is that the menu is dismissed regardless of whether setAutoDismiss is true or false.

              Comment


                #8
                Hi Jay
                Ok - we see the issue. This attribute is working if set on a root menu but not on a sub-menu as in the usage described here.
                We'll take a look and let you know when we have something

                Comment


                  #9
                  This should now be working (fix available in nightly builds going forward)

                  Comment


                    #10
                    Thanks for the fix. FYI - the documentation has the argument backwards. It says "When true, when a menu item is chosen (via mouse click or keyboard), the menu is not automatically hidden, staying in place for further interactivity". It's actually when *false* which is more intuitive anyway.

                    Comment

                    Working...
                    X