2013-08-05 8 views
2

닫기 버튼이없는 팝업 창이 있으므로 팝업 창을 닫으려면 페이지를 새로 고쳐야합니다. 이 경우 닫기 팝업 창에 버튼을 추가하고 싶습니다.EXT 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; 
} 

나는 다음을 추가하려고하지만 효과 : 여기

는 JS 코드입니다. 선택기가 잘못된

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

는'this.up ('창')에서 .''제거하려고 간단 가까운(). ' – MMT

+0

@MMT 안녕하세요, 불행하게도, 그것은 작동하지 않습니다. 나는 sth가 없습니까? –

+0

여기서'bbar'가 추가 되었습니까? – MMT

답변

1

, 그냥 매칭 위해 xtype와 부모를 찾을 수 window이어야한다.

+0

안녕하세요, 창 앞에 점을 지울 때 작동하지 않는 것 같습니다. –

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(); 
       } 
      }] 
     }) 
+0

안녕하세요, 여전히 작동하지 않습니다. –

+0

위의 코드를 시도하십시오. – Jacobian

+0

안녕하세요, 시도했지만 여전히 작동하지 않았습니다. –

1

이 작동합니다 :

var win = Ext.create('Ext.window.Window', { 
      title: 'test', 
      width: 400, 
      height: 200, 
      bbar:[{ 
       text:'Close', 
       handler: function(){ 
        win.destroy(); 
       } 
      }] 
     }) 

작업 예 : http://jsfiddle.net/RdVyz/

-1

하는 일을보십시오 닫기 처리기의 입니다.

this.up(). up(). close(); 또는 this.up(). close();

0

이 여전히 응답하지 간단한 방법

var wind = Ext.WindowManager.getActive(); 

if(wind){ 
    wind.close(); 
} 
0

흠 ... 나에게 보인다? 솔루션은

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(); 
      } 
     }] 
    })