From: Alan Knowles Date: Tue, 21 Jul 2020 06:44:04 +0000 (+0800) Subject: Pman.Delete.js X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=b78ad6a6013734f8bd0b392e90b89fa89a5ee4ec Pman.Delete.js --- diff --git a/Pman.Delete.js b/Pman.Delete.js index 013f424b..a5d2c1c7 100644 --- a/Pman.Delete.js +++ b/Pman.Delete.js @@ -35,55 +35,60 @@ Pman.Delete = { return; } + Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?", function(btn) { if (btn != 'yes') { return; } - // what about the toolbar?? - tab.grid.getView().mainWrap.mask("Deleting"); - new Pman.Request({ - url: baseURL + '/Roo/'+tbl+'.php', - method: 'POST', - params: { - _delete : r.join(',') - }, - success: function(response) { - tab.grid.getView().mainWrap.unmask(); - if ( tab.paging ) { - tab.paging.onClick('refresh'); - } else if (tab.grid.footer && tab.grid.footer.onClick) { - // new xtype built grids - tab.grid.footer.onClick('refresh'); - } else if (tab.refresh) { - tab.refresh(); // this might cause problems as panels have a refresh method? - } else { - tab.grid.getDataSource().load(); - } - - - - }, - failure: function(act) { - - Roo.log(act); - var msg = ''; - try { - msg = act.errorMsg; - } catch(e) { - msg = "Error deleting"; - } - tab.grid.getView().mainWrap.unmask(); - Roo.MessageBox.alert("Error", msg); - } - - }); + Pman.Delete.simpleCall(r); + } ); - return ''; - }, + }, + simpleCall : function(r) + { + // what about the toolbar?? + tab.grid.getView().mainWrap.mask("Deleting"); + new Pman.Request({ + url: baseURL + '/Roo/'+tbl+'.php', + method: 'POST', + params: { + _delete : r.join(',') + }, + success: function(response) { + tab.grid.getView().mainWrap.unmask(); + if ( tab.paging ) { + tab.paging.onClick('refresh'); + } else if (tab.grid.footer && tab.grid.footer.onClick) { + // new xtype built grids + tab.grid.footer.onClick('refresh'); + } else if (tab.refresh) { + tab.refresh(); // this might cause problems as panels have a refresh method? + } else { + tab.grid.getDataSource().load(); + } + + + + }, + failure: function(act) { + + Roo.log(act); + var msg = ''; + try { + msg = act.errorMsg; + } catch(e) { + msg = "Error deleting"; + } + tab.grid.getView().mainWrap.unmask(); + Roo.MessageBox.alert("Error", msg); + } + + }); + } progress : function(tab, tbl) {