1

Currently I am using GWT-bootstrap3 dropdown and dropdownmenu widgets. These widgets are in uibinder.xml file. In .java file, I am not able to handle change event on these widgets. For example, If i select different options from dropdown, I need to have selected option. How to handle onselection change event in GWT-bootstrap3 dropdown widget?? Please share ideas..

Thanks

yogish
  • 85
  • 17

1 Answers1

1

You can use AnchorListItem inside DropDownMenu, then you can addClickHandler to AnchorListItem objects.

In UI binder XML:

<b:DropDownMenu ui:field="menuUserInfo" addStyleNames="wt-dropdown-menu">
  <b:AnchorListItem ui:field="menuItemPreferences" text="Preferences"/>
  <b:AnchorListItem ui:field="menuItemLogout" text="Logout"/>
</b:DropDownMenu>

In Java code:

  menuItemLogout.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent clickEvent) {
      // Added logout logic
    }
  });
Jake W
  • 2,788
  • 34
  • 39