2012-04-25 6 views
0

ボタン?私はdoSomethingの関数を呼び出すために、ウィンドウや別を閉じるには1つのボタンをしたいと思います。煎茶タッチ:私はどのようにボタンが正しく動作しない煎茶タッチ2 とポップアップウィンドウ内のボタンを実装しようとしています

function foo(){ 
    Ext.Viewport.add({ 
     xtype: 'panel', 
     scrollable: true, 
     centered: true, 
     width: 400, 
     height: 300, 
     items:[ 
      { 
       docked: 'bottom', 
       xtype: 'titlebar', 
       items:[ 
        { 
         xtype: 'button', 
         ui: 'normal', 
         text: 'Do Something', 
         go: 'testsecond' 
        }, 
        { 
         xtype: 'button', 
         ui: 'normal', 
         text: 'Close', 
         go: 'testsecond',    
        },     
       ] 
      }, 
     ] 
    });//Ext.Viewport.add 
} 

function doSomething() { 
    console.log('hi'); 
} 

答えて

1

だけで、あなたがオーバーレイのに似た何かを必要としていると思うここ

または

{ 
    xtype: 'button', 
    ui: 'normal', 
    text: 'Close', 
    go: 'testsecond', 
    handler:function(){ 
     //do something. 
    }    
} 
0

簡単なようにボタンに

   { 
        xtype: 'button', 
        ui: 'normal', 
        text: 'Do Something', 
        go: 'testsecond', 
        handler:function(){ 
        //do something. 
        } 
       }, 
       { 
        xtype: 'button', 
        ui: 'normal', 
        text: 'Close', 
        go: 'testsecond', 
        handler:function(){ 
         //popup_window.hide(); 
        }    
       } 
1

をハンドラを追加Sencha Touch。

ポップアップのため、このパネルをフローティングパネルにする必要があります。ここで

は、彼らがどのように動作するかです:

Ext.Loader.setConfig({ 
    enabled: true 
}); 

Ext.application({ 
    name: 'FloatingPanelWindow', 

    launch: function() { 
     overlay = Ext.Viewport.add({ 
      xtype: 'panel', 
      scrollable: true, 
      modal: true,     // to make it floating 
      hideOnMaskTap: true,   // close the window by clicking on mask outside popup window 
      centered: true, 
      width: 400, 
      height: 300, 
      items:[ 
       { 
        docked: 'bottom', 
        xtype: 'titlebar', 
        items:[ 
         { 
          xtype: 'button', 
          ui: 'normal', 
          text: 'Do Something', 
          listeners : { 
           tap : function() { 
            overlay.hide(); // to close this popup window. 
            Ext.Msg.alert("Clicked on DoSomething"); //callDoSomethingMethod(); // perform your task here.        
           } 
          } 
         }, 
         { 
          xtype: 'button', 
          ui: 'normal', 
          text: 'Close', 
          listeners : { 
           tap : function() { 
            overlay.hide(); 
           } 
          }    
         },     
        ] 
         }, 
        ] 
    });//Ext.Viewport.add 
    } 
}); 

これは、あなたが取得するサンプル出力です。

enter image description here

関連する問題