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 に答える