2 * Generic Delete function (moved from Pman.js)
4 * with progressbar version.
11 selections : function(tab)
16 var s = tab.grid.getSelectionModel().getSelections();
18 Roo.MessageBox.alert("Error", "Select at least one Row to delete" );
21 var reader = tab.grid.reader || tab.grid.ds.reader;
22 for(var i = 0; i < s.length; i++) {
23 r.push(reader.getId(s[i].json));
28 // previous version - no progress..
30 simple : function(tab, tbl)
33 var r = this.selections(tab);
39 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
44 tab.grid.getView().mainWrap.mask("Deleting");
45 Pman.Delete.simpleCall(tab, tbl, r, function(response) {
46 Pman.Delete.completed(tab);
54 simpleCall : function(tab, tbl, r, resp)
56 // what about the toolbar??
59 url: baseURL + '/Roo/'+tbl,
65 failure: function(act) {
72 msg = "Error deleting";
74 tab.grid.getView().mainWrap.unmask();
75 Roo.MessageBox.alert("Error", msg);
81 progress : function(tab, tbl) {
83 var r = this.selections(tab);
89 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
94 Roo.MessageBox.progress("Delete Records", "Deleting 1/" + r.length );
99 var delItem = function ()
101 Roo.MessageBox.updateProgress( (p+1)/r.length, "Deleting " + (1+p) + "/" + r.length );
102 Pman.Delete.simpleCall(tab, tbl, [ r[p] ], function(response) {
106 Roo.MessageBox.hide();
107 Pman.Delete.completed(tab);
121 completed : function()
123 tab.grid.getView().mainWrap.unmask();
125 tab.paging.onClick('refresh');
126 } else if (tab.grid.footer && tab.grid.footer.onClick) {
127 // new xtype built grids
128 tab.grid.footer.onClick('refresh');
129 } else if (tab.refresh) {
130 tab.refresh(); // this might cause problems as panels have a refresh method?
132 tab.grid.getDataSource().load();