ExtJS 6.x Modern Button as a Link
Asked Answered
J

1

1

On menu items you are able to optionally add either a handler to handle press or mouseclick events or specify and href configuration so that when the menu is simply a link.

  {
     text: 'Example Ext Menu Item',
     iconCls: 'x-fa fa-cog',
     href: 'https://www.google.com'
  }

For the Ext.Button (Modern) how can you have the button act as a link while still supporting the other features of a button (icons, on hover etc).

For example I would like to be able to "right click" on any area of the button and "open in a new tab".

Jade answered 26/11, 2017 at 8:54 Comment(1)
Have you tried search this? Because certain examples that work on classic will work on modern too.Williawilliam
L
2

You can wrap the button in a custom element by overriding like this:

Ext.define('MyApp.components.MyButton', {
    extend: 'Ext.Button',
    xtype: 'mybutton',

    element: {
        reference: 'element',
        tag: 'a',
        href: 'http://www.foo.bar'     
    }
});
Lustick answered 27/11, 2017 at 21:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.