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 tab.grid.getView().mainWrap.unmask();
47 Pman.Delete.completed(tab);
55 simpleCall : function(tab, tbl, r, resp)
57 // what about the toolbar??
60 url: baseURL + '/Roo/'+tbl,
66 failure: function(act) {
73 msg = "Error deleting";
75 tab.grid.getView().mainWrap.unmask();
76 Roo.MessageBox.alert("Error", msg);
82 progress : function(tab, tbl) {
84 var r = this.selections(tab);
90 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
95 Roo.MessageBox.progress("Delete Records", "Deleting 1/" + r.length );
100 var delItem = function ()
102 Roo.MessageBox.updateProgress( (p+1)/r.length, "Deleting " + (1+p) + "/" + r.length );
103 Pman.Delete.simpleCall(tab, tbl, [ r[p] ], function(response) {
107 Roo.MessageBox.hide();
108 Pman.Delete.completed(tab);
122 completed : function(tab)
126 tab.paging.onClick('refresh');
127 } else if (tab.grid.footer && tab.grid.footer.onClick) {
128 // new xtype built grids
129 tab.grid.footer.onClick('refresh');
130 } else if (tab.grid) {
131 tab.grid.getDataSource().load({});
132 } else if (tab.refresh) {
133 tab.refresh(); // this might cause problems as panels have a refresh method?