From: pines Date: Thu, 8 Mar 2007 20:11:00 +0000 (+0000) Subject: delay auto-select and call on_select X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a65cbec5ebf8edaedca68d9d9e3ecef2b887a843;p=Evergreen.git delay auto-select and call on_select git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0_3@7047 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index f90a95fc8e..dd9c2fe7c9 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -340,7 +340,14 @@ util.list.prototype = { if (typeof params.to_bottom != 'undefined') { treechildren_node.appendChild( treeitem ); if (typeof params.no_auto_select == 'undefined') { - try { obj.node.view.selection.select(Number(obj.node.view.rowCount)-1); } catch(E) { obj.error.sdump('D_ALERT','tree auto select: ' + E + '\n'); } + if (!obj.auto_select_pending) { + obj.auto_select_pending = true; + setTimeout(function() { + try { obj.node.view.selection.select(Number(obj.node.view.rowCount)-1); } catch(E) { obj.error.sdump('D_ALERT','tree auto select: ' + E + '\n'); } + try { if (typeof params.on_select == 'function') params.on_select(); } catch(E) { obj.error.sdump('D_ALERT','tree auto select, on_select: ' + E + '\n'); } + obj.auto_select_pending = false; + }, 1000); + } } } else { if (treechildren_node.firstChild) { @@ -349,7 +356,14 @@ util.list.prototype = { treechildren_node.appendChild( treeitem ); } if (typeof params.no_auto_select == 'undefined') { - try { obj.node.view.selection.select(0); } catch(E) { obj.error.sdump('D_ALERT','tree auto select: ' + E + '\n'); } + if (!obj.auto_select_pending) { + obj.auto_select_pending = true; + setTimeout(function() { + try { obj.node.view.selection.select(0); } catch(E) { obj.error.sdump('D_ALERT','tree auto select: ' + E + '\n'); } + try { if (typeof params.on_select == 'function') params.on_select(); } catch(E) { obj.error.sdump('D_ALERT','tree auto select, on_select: ' + E + '\n'); } + obj.auto_select_pending = false; + }, 1000); + } } } var treerow = document.createElement('treerow');