2

閉じるボタンのないポップアップ ウィンドウがあるため、ポップアップ ウィンドウを閉じるにはページを更新する必要があります。この場合、ポップアップウィンドウに閉じるボタンを追加したいと思います。

jsコードは次のとおりです。

function oseGetWIn(id, title, width, height)
{
    var win = Ext.create('Ext.window.Window', {
        id: id,
        name: id,
        title: title,
        width: width,
        height: height,
        closeAction:'destroy',
        autoScroll:'true',

    }); 
    return win; 
}

以下を追加しようとしましたが、効果がありません。

bbar: [
        {
          text: 'Close',
          handler: function () { this.up('.window').close(); }
         }
      ],
4

6 に答える 6

1

windowセレクターが正しくありません。一致する xtype を持つ親を検索する のはずです。

于 2013-08-05T05:42:55.393 に答える
1

うーん...まだ答えていませんか?解決策は簡単です

var win = Ext.create('Ext.window.Window', {
        id: id,
        name: id,
        title: title,
        width: width,
        height: height,
        closeAction:'destroy',
        autoScroll:'true',
        closable:true,
        bbar:[{
            text:'Close',
            handler:function(bt){
                bt.up('window').close();
            }
        }]
    })
于 2016-05-16T23:23:56.627 に答える
0

これを試して

var win = Ext.create('Ext.window.Window', {
    id: id,
    name: id,
    title: title,
    width: width,
    height: height,
    closeAction:'destroy',
    autoScroll:'true',
    closable:true // add this attribute and you will get a close button on right top
});

編集:今これを試してください:

var win = Ext.create('Ext.window.Window', {
            id: id,
            name: id,
            title: title,
            width: width,
            height: height,
            closeAction:'destroy',
            autoScroll:'true',
            closable:true,
            bbar:[{
                text:'Close',
                handler:function(){
                    this.up('window').destroy();
                }
            }]
        })
于 2013-08-05T05:43:45.647 に答える
0

これは私には最も簡単な方法のようです

var wind = Ext.WindowManager.getActive();

if(wind){
     wind.close();
}
于 2016-05-13T15:03:20.977 に答える
-1

クローズハンドラーでこれを試してください

this.up().up().close(); または this.up().close();

于 2013-08-06T04:37:33.250 に答える