[open-ils-commits] r7717 -
trunk/Open-ILS/xul/staff_client/chrome/content/util
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Aug 26 01:38:40 EDT 2007
Author: phasefx
Date: 2007-08-26 01:33:11 -0400 (Sun, 26 Aug 2007)
New Revision: 7717
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
Log:
Bug fix for list class, where refresh-row functionality broke the on_all_fleshed callback handler. Since rows in a list can flesh themselves out asynchonously, and some actions want to act on all rows in a list, we have a function that asks the whole list to flesh itself (because unseen rows normally don't), and a way to pass a callback function for when the list has been completely fleshed. Internally, it keeps a count of total rows and total fleshed rows, and if the two are equal, then the list is considered fleshed. However, the recent refresh-a-single-row functionality was effectively increasing the total fleshed rows tally without first adjusting it, and you would get fleshed rows > total rows, and the callback would never fire. So this fixes all of that.
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2007-08-26 05:23:02 UTC (rev 7716)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2007-08-26 05:33:11 UTC (rev 7717)
@@ -327,6 +327,7 @@
rparams.my_node.setAttribute(i,params.attributes[i]);
}
}
+ this.row_count.fleshed--;
return rparams;
},
@@ -410,7 +411,7 @@
if (treerow.getAttribute('fleshed') == 'true') return; /* already fleshed */
treerow.setAttribute('fleshed','true');
obj.row_count.fleshed++;
- if (obj.row_count.fleshed == obj.row_count.total) {
+ if (obj.row_count.fleshed >= obj.row_count.total) {
if (typeof obj.on_all_fleshed == 'function') {
setTimeout( function() { obj.on_all_fleshed(); }, 0 );
}
@@ -468,7 +469,7 @@
treerow.setAttribute('retrieved','true');
treerow.setAttribute('fleshed','true');
obj.row_count.fleshed++;
- if (obj.row_count.fleshed == obj.row_count.total) {
+ if (obj.row_count.fleshed >= obj.row_count.total) {
if (typeof obj.on_all_fleshed == 'function') {
setTimeout( function() { obj.on_all_fleshed(); }, 0 );
}
@@ -560,7 +561,7 @@
if (treerow.getAttribute('fleshed') == 'true') return; /* already fleshed */
treerow.setAttribute('fleshed','true');
obj.row_count.fleshed++;
- if (obj.row_count.fleshed == obj.row_count.total) {
+ if (obj.row_count.fleshed >= obj.row_count.total) {
if (typeof obj.on_all_fleshed == 'function') {
setTimeout( function() { obj.on_all_fleshed(); }, 0 );
}
@@ -618,7 +619,7 @@
treerow.setAttribute('retrieved','true');
treerow.setAttribute('fleshed','true');
obj.row_count.fleshed++;
- if (obj.row_count.fleshed == obj.row_count.total) {
+ if (obj.row_count.fleshed >= obj.row_count.total) {
if (typeof obj.on_all_fleshed == 'function') {
setTimeout( function() { obj.on_all_fleshed(); }, 0 );
}
@@ -765,15 +766,15 @@
'_full_retrieve_tree' : function(params) {
var obj = this;
try {
- if (obj.row_count.total == obj.row_count.fleshed) {
- //alert('Full retrieve... tree seems to be in sync\n' + js2JSON(obj.row_count));
+ if (obj.row_count.fleshed >= obj.row_count.total) {
+ dump('Full retrieve... tree seems to be in sync\n' + js2JSON(obj.row_count) + '\n');
if (typeof obj.on_all_fleshed == 'function') {
setTimeout( function() { obj.on_all_fleshed(); }, 0 );
} else {
- alert('.full_retrieve called with no callback?');
+ dump('.full_retrieve called with no callback?' + '\n');
}
} else {
- //alert('Full retrieve... syncing tree' + js2JSON(obj.row_count));
+ dump('Full retrieve... syncing tree' + js2JSON(obj.row_count) + '\n');
JSAN.use('util.widgets');
var nodes = obj.treechildren.childNodes;
for (var i = 0; i < nodes.length; i++) {
More information about the open-ils-commits
mailing list