make things a little more responsive
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 11:07:28 +0000 (11:07 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 11:07:28 +0000 (11:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2529 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index c04c119..7f0caf3 100644 (file)
@@ -111,6 +111,8 @@ util.list.prototype = {
 
        '_append_to_tree' : function (params) {
 
+               var obj = this;
+
                if (typeof params.row == 'undefined') throw('util.list.append: Object must contain a row');
 
                var s = ('util.list.append: params = ' + js2JSON(params) + '\n');
@@ -126,24 +128,27 @@ util.list.prototype = {
 
                if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
 
-                       treerow.setAttribute('retrieve_id',params.retrieve_id);
-                       //FIXME//Make async and fire when row is visible in list
-                       var row;
-                       if (typeof params.retrieve_row == 'function') {
-
-                               row = params.retrieve_row( params );
+                       setTimeout(
+                               function() {
+                                       treerow.setAttribute('retrieve_id',params.retrieve_id);
+                                       //FIXME//Make async and fire when row is visible in list
+                                       var row;
+                                       if (typeof params.retrieve_row == 'function') {
 
-                       } else {
+                                               row = params.retrieve_row( params );
 
-                               if (typeof this.retrieve_row == 'function') {
+                                       } else {
 
-                                       row = this.retrieve_row( params );
+                                               if (typeof obj.retrieve_row == 'function') {
 
-                               }
-                       }
-                       params.row = row;
-                       this._map_row_to_treecell(params,treerow);
+                                                       row = obj.retrieve_row( params );
 
+                                               }
+                                       }
+                                       params.row = row;
+                                       obj._map_row_to_treecell(params,treerow);
+                               }, 0
+                       );
                } else {
                        this._map_row_to_treecell(params,treerow);
                }
@@ -154,6 +159,8 @@ util.list.prototype = {
 
        '_append_to_listbox' : function (params) {
 
+               var obj = this;
+
                if (typeof params.row == 'undefined') throw('util.list.append: Object must contain a row');
 
                var s = ('util.list.append: params = ' + js2JSON(params) + '\n');
@@ -164,32 +171,34 @@ util.list.prototype = {
 
                if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
 
-                       listitem.setAttribute('retrieve_id',params.retrieve_id);
-                       //FIXME//Make async and fire when row is visible in list
-                       var row;
-                       if (typeof params.retrieve_row == 'function') {
+                       setTimeout(
+                               function() {
+                                       listitem.setAttribute('retrieve_id',params.retrieve_id);
+                                       //FIXME//Make async and fire when row is visible in list
+                                       var row;
+                                       if (typeof params.retrieve_row == 'function') {
 
-                               row = params.retrieve_row( params );
+                                               row = params.retrieve_row( params );
 
-                       } else {
-
-                               if (typeof this.retrieve_row == 'function') {
+                                       } else {
 
-                                       row = this.retrieve_row( params );
+                                               if (typeof obj.retrieve_row == 'function') {
 
-                               }
-                       }
-                       params.row = row;
-                       this._map_row_to_listcell(params,listitem);
+                                                       row = obj.retrieve_row( params );
 
+                                               }
+                                       }
+                                       params.row = row;
+                                       obj._map_row_to_listcell(params,listitem);
+                                       obj.node.appendChild( listitem );
+                               }, 0
+                       );
                } else {
                        this._map_row_to_listcell(params,listitem);
+                       this.node.appendChild( listitem );
                }
 
-               this.node.appendChild( listitem );
-
                this.error.sdump('D_LIST',s);
-
                return listitem;
 
        },