2013-06-12 11 views
0

我如何使它工作?Ext js popup如何讓它工作?在行動鏈接

我想把刪除圖標放在我的網格中,就像彈出確認的柱狀圖。 你想刪除x項目?

做出這樣的事情,但它不工作

{ 
      xtype: 'actioncolumn', 
      width: 50, 
      items: [ 
       { 
        icon: 'delete.gif',    // Use a URL in the icon config 
        tooltip: 'Delete Product', 
        handler: function (grid, rowIndex, colIndex) { 
         var rec = store.getAt(rowIndex); 
         var id = rec.get('ID'); 

         Ext.MessageBox.show({ 
          title: 'Save Changes?', 
          msg: 'Do you want to delete ' + rec.get('Name') + ' ?', 
          buttons: Ext.MessageBox.OKCANCEL, 
          fn: showResult 


         }); 


        } 
       } 
      ] 
     } 

回答

1

對於艾伯塔省按鈕:

handler: function (grid, rowIndex, colIndex) { 
      var rec = grid.store; 
      Ext.MessageBox.show({ 
       title: 'Address', 
       msg: 'Do you want to delete ?', 
       buttons: Ext.MessageBox.OKCANCEL, 
       fn: function showResultText(btn) { 
         if (btn == 'ok') { 
          rec.removeAt(rowIndex); 
         } 
        } 
       }); 


      } 
2

使用confirm而不是show

Ext.MessageBox.confirm('Save Changes?', 'Do you want to delete ' + rec.get('Name') + ' ?', function(r) { 
    if (r == 'yes') { 
     rec.destroy(); 
    } 
}); 
+0

謝謝,但有選擇,使OKCANCLE鈕釦 ? – Dox