开发者

ext window with bugs on reopening

I have a checkbox that triggers a function that opens a small window with a grid and a form. If closeAction:'close' the window is not reopened after closing (some error). If closeAction:'hide' the window is reopened with a mess instead of its items.

I know that I can solve the problem by id:Ext.id() though I have other functions that are using the id's. Is there a way to reopen th开发者_JAVA技巧e window without these problems? Part of the function creating the window, nothing unusual:

var errWindow = new Ext.Window({
        width:300,
        title:headerStr,
        closeAction:'hide',
        items: [errForm,problemsGrid]
    });
errWindow.show();

The items of the form have id's like: "textfieldNumber1". Without the id's everithing works fine, but with them I get this

ext window with bugs on reopening


If you use closeAction: 'close' which is the default, then the window cannot be reopened with show(). If you use use closeAction: 'hide' then the window can be shown and hidden but you must do this with hide() and show() calls. A call to close() will destroy the window regardless of what closeAction is set to.


Is it that you want to destroy your form when user clicks on close, while keeping window hidden for re-use?

if so,

  1. Listen to beforeClose event, and remove form from window's items
  2. Call windows.hide()

Also, you need to add new form (since you destroyed it), while showing window again. listen to beforeShow to do that.


I had the same problem . As "Narenda Kamma" already mentioned before need to listen to beforeClose and then call to destroy function . See example below

var me = this

   this.window.on("beforeclose",
                     function (com, eOpts) { me.closeWindow() });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜