backport to 1.2 a fix for single-row refresh and on_all_fleshed callback
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 26 Aug 2007 05:36:53 +0000 (05:36 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 26 Aug 2007 05:36:53 +0000 (05:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7718 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/list.js

index 4271a41..42106be 100644 (file)
@@ -327,6 +327,7 @@ util.list.prototype = {
                                rparams.my_node.setAttribute(i,params.attributes[i]);
                        }
                }
+        this.row_count.fleshed--;
                return rparams;
        },
 
@@ -410,7 +411,7 @@ util.list.prototype = {
                                                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 @@ util.list.prototype = {
                                        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 @@ util.list.prototype = {
                                                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 @@ util.list.prototype = {
                                        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 @@ util.list.prototype = {
        '_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++) {