Poor programmer
Poor programmer

Reputation: 341

how to open new tab and redirect to link EXT JS portlet button

if i click the portlet button, it must open new tab and direct to the website that i have calling. unfortunately, i cannot achieve that. i have tried looking at sencha discussion and stuffs and i dont see anything. When i click the button portlet, nothing happends heres my code below..

var btnProductsAndServices = {
    xtype: 'portletbutton',
    icon: '/test.png',
    tooltip: 'Products & Services',
    text: 'Products & Services',
    click : window.open("https://www.w3schools.com")
};

i have tried doing this as well, not worked.

var btnProductsAndServices = {
    xtype: 'portletbutton',
    icon: '/test.png',
    tooltip: 'Products & Services',
    text: 'Products & Services',
    click : {
        handler: function redirect(){
            window.open("https://www.w3schools.com")
        }
    }
};

Upvotes: 1

Views: 1558

Answers (1)

Muzaffer Galata
Muzaffer Galata

Reputation: 642

I do not know what the portletbutton is, but you can do it like below with button:

Ext.create({
            xtype: 'button',
            tooltip: 'Products & Services',
            text: 'Products & Services',
            renderTo: 'divButton',
            handler: function () {
                window.open("https://www.w3schools.com");
            }
        });

https://fiddle.sencha.com/#fiddle/3aka

Upvotes: 3

Related Questions