2
votes

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();
3

3 Answers

1
votes

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.

1
votes

On Cancel click of your window,

instead of using

this.up('.window').close();

You should use

this.up('.window').destroy();

because then only it will destroy the whole window including dom. So everytime you open it, it will new and fresh.. ;)

0
votes

Maybe you just not define a div element in the body like me.

<div id="helloWorldPanel">
</div>