1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    22
    Vote Rating
    0
    abram.darnutzer is on a distinguished road

      0  

    Default Unanswered: Window will now show on 1st attempt

    Unanswered: Window will now show on 1st attempt


    On a button press, I'm trying to open show a new window. On the first press of the button, nothing seems to happen. On the second press, it pops up the window as it should. I've watched to code in debug and it seems to be hitting the proper lines and there are no errors in the Developer Console. So, I end up with 2 versions of the Window created. One showing, one not.

    This will cause me issues when trying to to a component query on the items in this window, since there will be double the results.

    Here is my code to launch the window. It looks to be hitting all the code with no errors.
    Code:
    myitemwindow = new Ext.Window({
    itemId: 'MyItemEditWindow',
    minHeight: 400,
    minWidth: 600,
    layout: {
    type: 'fit'
    },
    items: [
    {
    xtype: 'myItemEdit'
    }
    ]
    });
    myitemwindow.show();
    Any help here would be greatly appreciated.

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,417
    Answers
    434
    Vote Rating
    201
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    The following worked ok for me in 4.2.1:

    Code:
    Ext.widget('button', {
        renderTo: document.body,
        text: 'Show Window',
        handler: function () {
            var myitemwindow = Ext.ComponentQuery.query('#MyItemEditWindow')[0];
    
    
            if (!myitemwindow) {
                myitemwindow = new Ext.Window({
                    itemId: 'MyItemEditWindow',
                    minHeight: 400,
                    minWidth: 600,
                    layout: {
                        type: 'fit'
                    },
                    items: [{
                        //xtype: 'myItemEdit'
                        xtype: 'panel'
                    }]
                });
            }
    
    
            myitemwindow.show();
        }
    });
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

  3. #3
    Sencha User
    Join Date
    May 2013
    Posts
    22
    Vote Rating
    0
    abram.darnutzer is on a distinguished road

      0  

    Default


    Thanks. This is a good way to prevent it from creating more than one window.

    I found out why the 1st one wasn't showing. There were no heights/widths set in the "myItemEdit", so it was defaulting them to zero.

    This is fixed now. Thanks for the help.

Thread Participants: 1

Tags for this Thread