From aec015c039d28de3c7fdf55af999ab89e1698187 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 2 Jan 2007 11:28:04 +0000 Subject: [PATCH] Dramatically speed up items pane sorting (~65% reduction in sort time on a test library of 195 items) (Moved redundant string manipulation out of the sort() callback. I put it there by mistake in r831 when namespacing all the XUL ids right before b2.r2.) --- chrome/content/zotero/xpcom/itemTreeView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index e5656b9c5c..91e841a438 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -513,6 +513,7 @@ Zotero.ItemTreeView.prototype.sort = function() column = this._treebox.columns.getFirstColumn(); } var order = column.element.getAttribute('sortDirection') == 'ascending'; + var columnField = column.id.substring(13, column.id.length-7); if(column.id == 'zotero-items-typeIcon-column') { @@ -535,8 +536,8 @@ Zotero.ItemTreeView.prototype.sort = function() { function columnSort(a,b) { - var fieldA = a.getField(column.id.substring(13, column.id.length-7)); - var fieldB = b.getField(column.id.substring(13, column.id.length-7)); + var fieldA = a.getField(columnField); + var fieldB = b.getField(columnField); if(typeof fieldA == 'string') {