From b830910939ef1dc5d6fb267e1e6d77d2cf1d59e3 Mon Sep 17 00:00:00 2001 From: phasefx Date: Tue, 27 Dec 2005 11:07:28 +0000 Subject: [PATCH] make things a little more responsive git-svn-id: svn://svn.open-ils.org/ILS/trunk@2529 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/evergreen/util/list.js | 67 +++++++++++-------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js index c04c1199ec..7f0caf3d14 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js @@ -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; }, -- 2.43.2