View Full Version : Overriding MenuItem's href reference

28 Nov 2011, 12:43 PM
If you right click on a menu item and select open in new tab or window, the window will open in the root of your application, we wanted to take advantage of this but it seems to be not over-redable.

In the MenuItem.onRender code:

protected void onRender(Element target, int index) {
super.onRender(target, index);
setElement(DOM.createAnchor(), target, index);

if (GXT.isAriaEnabled()) {
Accessibility.setRole(getElement(), Accessibility.ROLE_MENUITEM);
} else {
getElement().setPropertyString("href", "#");

String s = itemStyle + (subMenu != null ? " x-menu-item-arrow" : "");

if (widget != null) {
} else {

if (subMenu != null) {
Accessibility.setState(getElement(), "aria-haspopup", "true");

The "getElement().setPropertyString("href", "#");" line is providing this functionality. There doesn't seem to be a way to override this without overriding the whole onRender method; which we'd prefer not to do. Is there a preferred way to do this?

21 Mar 2012, 7:54 PM
I am pretty interested in how to do this too!