简体   繁体   English

如何在ExtJs中更改Ext.window.Window的URL

[英]How to change url of Ext.window.Window in ExtJs

I am creating model dialog using ExtJS. 我正在使用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. 在单击此按钮时,我想调用struts2动作,这意味着我想更改弹出窗口的URL。

If I use window.location to call struts2 action then it changes url of parent window instead of pop up window. 如果我使用window.location调用struts2操作,则它将更改父窗口的URL,而不是弹出窗口的URL。 Can anyone please help me in this? 有人可以帮我吗?

The window variable is an object reference to the current browser window. 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. 在窗口组件中使用loader ,应添加代码以获取加载程序并使用其方法加载新的资源位置。 Something like this should work. 这样的事情应该起作用。

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

References: 参考文献:

Loader - Load Method 装载机-装载方法

getLoader method getLoader方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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