开发者

Open multiple child windows and keep track of them all

So here is the situation. I have a button on one of my extjs pages. This button opens a child window as a pop-up. This child window has a .method attribute as well as a .ref attribute, and also a .id. I need the functionality to open another window with the SAME template, everytime I click that button.

I was thinking set the childwindow .method property to something like 'getWindow', and the .ref to something like 'newWindow' and then create a javascript function on the backend to look something like this:

var myArray = [];
var count = 0;
function getWindow() {
    newWindow.Id = count;
    getWindow().show();
    myArray[count] = count;
    count++;
}

Would this work?

Edit:

Using ViewDetailsWin As New Pages.ChildWindow
        With ViewDetail开发者_JAVA技巧sWin
            .Id = "Test"
            .IconCls = Model.WorkflowStepDefinition.SmallIcon
            .Ref = "viewDetailsWin"
            .RenderTo = "workspacePanel.getEl()"
            .DestroyerRef = "mainPanel"
            .MethodName = "getViewDetailsWin"
            .Title = "View Details/Amortization Schedule"
            .Layout = Pages.Panel.LayoutType.Fit
            .Closable = True
            .CloseAction = Pages.Window.CloseActionType.Hide
            .Minimizable = True
            .Modal = False
            .Height = 700
            .Width = 1000
            .BodyStyle = "padding:10px"

There is more to it....


What do you mean by same template? Do you want an exact same window on clicking that button? Then create a Ext.Window component and create a new instance every time the button is clicked.

For example:

MyWindow = Ext.extend(Ext.Window, {
    width: 300,
    height: 300,
    title : 'my window',
    ref: 'whatever',
    method: function(){},
    initComponent: function () {
        MyWindow.superclass.initComponent.call(this);
    }
});

function createWindow(){
     var win = new MyWindow();
     win.show();
}

On click of the button call this createWindow function. Now to keep track of all the Windows, have a look at the WindowGroup or WindowMgr component of ExtJS.


I went a different route. I created another View called 'Details.aspx' in the same MVC folder. Then with Javascript I just open that view as a popup each time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜