1. #1
    Sencha User
    Join Date
    Apr 2009
    Posts
    1
    Vote Rating
    0
    imp is on a distinguished road

      0  

    Default Unanswered: Overriding MenuItem's href reference

    Unanswered: Overriding MenuItem's href reference


    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:

    Code:
      @Override
      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" : "");
        addStyleName(s);
    
        if (widget != null) {
          setWidget(widget);
        } else {
          setText(text);
        }
    
        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?

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Posts
    102
    Vote Rating
    0
    scaddenp is on a distinguished road

      0  

    Default


    I am pretty interested in how to do this too!

Thread Participants: 1

Tags for this Thread