Results 1 to 4 of 4

Thread: new window from tab is aligned badly

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2012
    Posts
    44
    Answers
    3

    Default Answered: new window from tab is aligned badly

    Hello,
    I have a tab panel with my tabs and I'd like to popup a window once the user click on a particular tab button.

    What i do is to create a new window and then show it.
    Code:
    var win = Ext.create(Myapp.view.MyWindow);
    win.show();
    Above is the code i call. I have two different behaviour. If a button inside the screen is executing such code, the window is created in the right position: in the center.
    If the code is called on a "activate" event of a tab, the window is created far under the page.

    what could i do to show the window in the center once "show" is called?

  2. Actually, after several tries, i found out a easy solution.

    after render the window, i simply call its method "center".
    and the window is centered.

    A trivial solution, still wondering why i have to do so. But it works.
    Thanks for the support.

  3. #2
    Sencha - Support Team bjdurham85's Avatar
    Join Date
    Mar 2014
    Posts
    962
    Answers
    55

    Default

    Hi--,

    You could be running into some race conditions with it being rendered. Could you call the show within a defer?

    http://docs.sencha.com/extjs/6.2.0/c...l#method-defer

    Bryan

  4. #3
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    361
    Answers
    37

    Default

    Where do you render the window?

    https://docs.sencha.com/extjs/6.2.1/...ow.Window.html
    By default, Windows will be rendered to document.body. To constrain a Window to another element specify renderTo.


    Also, you can add the window to a another container (which often gives you other benefits, like in garbage collection).
    Code:
    myTabPanel.add(win)
    Good luck /Emil

  5. #4
    Ext JS Premium Member
    Join Date
    Feb 2012
    Posts
    44
    Answers
    3

    Default

    Actually, after several tries, i found out a easy solution.

    after render the window, i simply call its method "center".
    and the window is centered.

    A trivial solution, still wondering why i have to do so. But it works.
    Thanks for the support.

Similar Threads

  1. Replies: 7
    Last Post: 2 Feb 2017, 10:22 PM
  2. Replies: 5
    Last Post: 10 May 2016, 8:27 AM
  3. Replies: 2
    Last Post: 7 Nov 2014, 1:37 AM
  4. Replies: 2
    Last Post: 4 May 2011, 8:59 AM
  5. Replies: 2
    Last Post: 13 Dec 2009, 8:01 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •