简体   繁体   中英

How to change url of Ext.window.Window in ExtJs

I am creating model dialog using ExtJS. Below is the Code for it,

var win;
Ext.application({
    name : 'Fiddle',
    launch : function() {
        var button = Ext.get('copy_button');

        button.on('click', function(){
            win = Ext.create('Ext.window.Window', {
                title: 'Copy Existing',
                height: 400,
                width: 500,
                layout: 'fit',
                modal: true,
                loader: {
                    url: '<%= request.getContextPath() %>/demo/copy.action',
                    autoLoad: true
                }
            });

            win.show(this, function() {
                button.dom.disabled = false;
            });
        });
    }
});

The resulting page in the popup contain one button. On click of this button I want to call struts2 action means I want to change url of popup.

If I use window.location to call struts2 action then it changes url of parent window instead of pop up window. Can anyone please help me in this?

The window variable is an object reference to the current browser window. This would be useful in this situaton.

As you are using loader in the window component you should add code to get the loader and load a new resource location using its methods. Something like this should work.

button.on('click', function() {
   var loader = win.getLoader();
   loader.load('new-url')
});

References:

Loader - Load Method

getLoader method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM