[open-ils-commits] r12918 - trunk/Open-ILS/web/js/ui/default/acq/picklist (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 20 13:32:11 EDT 2009
Author: erickson
Date: 2009-04-20 13:32:06 -0400 (Mon, 20 Apr 2009)
New Revision: 12918
Modified:
trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
Log:
fixed some grid update and progress bugs with merge/clone
Modified: trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js 2009-04-20 17:31:26 UTC (rev 12917)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js 2009-04-20 17:32:06 UTC (rev 12918)
@@ -94,22 +94,28 @@
if(selected.length == 0 || !(fields.name)) return;
var item = selected[0]; // clone the first selected
+ var plId = plListGrid.store.getValue(item, 'id');
+ var entryCount = Number(plListGrid.store.getValue(item, 'entry_count'));
+
progressDialog.show();
- progressDialog.update({maximum:item.entry_count, progress:0});
+ progressDialog.update({maximum:entryCount, progress:0});
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.picklist.clone'],
{ async: true,
- params: [openils.User.authtoken, item.id, fields.name],
+ params: [openils.User.authtoken, plId, fields.name],
+
onresponse : function(r) {
var resp = openils.Util.readResponse(r);
if(!resp) return;
progressDialog.update({progress:resp.li});
+
if(resp.complete) {
progressDialog.hide();
var pl = resp.picklist;
plCache[pl.id()] = pl;
pl.owner(openils.User.user);
+ pl.entry_count(entryCount);
plListGrid.store.newItem(fieldmapper.acqpl.toStoreItem(pl));
}
}
@@ -135,10 +141,14 @@
var totalLi = 0;
var selected = plListGrid.selection.getSelected();
var leadPl = plCache[fields.lead];
+ var leadPlItem;
dojo.forEach(selected, function(item) {
var id = plListGrid.store.getValue(item, 'id');
- if(id == fields.lead) return;
+ if(id == fields.lead) {
+ leadPlItem = item;
+ return;
+ }
totalLi += new Number(plListGrid.store.getValue(item, 'entry_count'));
ids.push(id);
});
@@ -158,6 +168,7 @@
if(resp.complete) {
progressDialog.hide();
leadPl.entry_count( leadPl.entry_count() + totalLi );
+ plListGrid.store.setValue(leadPlItem, 'entry_count', leadPl.entry_count());
// remove the deleted lists from the grid
dojo.forEach(selected, function(item) {
@@ -169,7 +180,6 @@
}
}
);
-
}
openils.Util.addOnLoad(loadGrid);
More information about the open-ils-commits
mailing list