Uncaught TypeError: Unable to read property 'dom' from null

advertisements

When click first time on showbutton then window open perfectly but when i close window and again open this then its giving error("Cannot read property 'dom' of null ") on line 'shiftWindow.show();'. Any help is appreciated.

var shiftWindow = Ext.create('Ext.window.Window', {
    title: 'Edit Shift',
    resizable: false,
    id: 'shiftwindow',
    width: 465,
    //bodyPadding: 5,
    modal: true,
    store: shiftStorePlanner,

    items: {
        xtype: 'form',
        id: 'idFormShift',
        bodyPadding: 10,
        items: shiftViewModelPlannerData
    },
    buttons: [{
        text: 'Save',
        cls: 'planner-save-button',
        overCls: 'planner-save-button-over',
        handler: function () {
            var wi = this.up('.window');
            var form = Ext.getCmp('idFormShift');
            if (form.isValid()) {
                shiftTimemappingarray = [];
                //  getShiftTime();
                setShiftTimeDetails();
            }
        }
    }, {
        text: 'Cancel',
        handler: function () {
            this.up('.window').close();
        }
    }]
});
shiftWindow.show();


If you are calling close() on the window, the window is destroyed. It no longer exists in the DOM. You'll have to create it again before calling show().

Alternatively, instead of closing it, you can hide() the window. Then it will remain and not require another creation. Note that the upper right-hand 'x' will still fire the close event.