0

我怎样才能使它工作?

我想把删除图标放在我的网格中,就像一个带有弹出确认的列操作。您要删除 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


                        });


                    }
                }
            ]
         }
4

2 回答 2

2

使用confirm代替show

Ext.MessageBox.confirm('Save Changes?', 'Do you want to delete ' + rec.get('Name') + ' ?', function(r) {
    if (r == 'yes') {
        rec.destroy();
    }
});
于 2013-06-12T08:09:19.987 回答
1

对于 OKCANCEL 按钮:

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


            }
于 2013-06-12T09:20:43.753 回答