[open-ils-commits] r11747 - trunk/Open-ILS/web/js/ui/default/conify/global/config

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jan 5 16:28:34 EST 2009


Author: erickson
Date: 2009-01-05 16:28:30 -0500 (Mon, 05 Jan 2009)
New Revision: 11747

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js
Log:
implemented delete

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js	2009-01-05 21:03:00 UTC (rev 11746)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js	2009-01-05 21:28:30 UTC (rev 11747)
@@ -12,8 +12,8 @@
 var marcForm = {};
 var vrForm = {};
 var pcrud = new openils.PermaCrud();
+var hmCache = [];
 
-
 function getOrgInfo(rowIndex, item) {
     if(!item) return '';
     var orgId = this.grid.store.getValue(item, this.field);
@@ -136,5 +136,31 @@
         }
     );
 }
+function deleteFromGrid() {
+    _deleteFromGrid(hmGrid.selection.getSelected(), 0);
+}   
 
+function _deleteFromGrid(list, idx) {
+    if(idx >= list.length) // we've made it through the list
+        return;
+
+    var item = list[idx];
+    var id = hmGrid.store.getValue(item, 'id');
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.delete.chmm'],
+        {   async: true,
+            params: [openils.User.authtoken, id],
+            oncomplete: function(r) {
+                if(stat = openils.Util.readResponse(r)) {
+                    // delete succeeded, remove it from the grid and the local cache
+                    hmGrid.store.deleteItem(item); 
+                    delete hmCache[item.code];
+                }
+                _deleteFromGrid(list, ++idx);
+            }
+        }
+    );
+}
+
 openils.Util.addOnLoad(init);
\ No newline at end of file



More information about the open-ils-commits mailing list