Fixing slowness of trees. We now don't sort on get cell text, we only sort before adding the view, and after they click on the tree to sort.

This commit is contained in:
mikep%oeone.com 2002-11-05 18:44:27 +00:00
parent 4e9b0249fd
commit 9ee2b36afb
2 changed files with 25 additions and 18 deletions

View File

@ -516,15 +516,6 @@ var treeView =
setTree : function( tree ){this.tree = tree;},
getCellText : function(row,column)
{
var columnElement = document.getElementById(column);
var sortActive = columnElement.getAttribute("sortActive");
if (sortActive == "true")
{
this.selectedColumn = column;
this.sortDirection = columnElement.getAttribute("sortDirection");
gEventArray.sort(sortEvents);
}
calendarEvent = gEventArray[row];
var calendarStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
switch( column )
@ -641,6 +632,18 @@ function refreshEventTree( eventArray )
treeView.rowCount = gEventArray.length;
var ArrayOfTreeCols = document.getElementById( UnifinderTreeName ).getElementsByTagName( "treecol" );
for( var i = 0; i < ArrayOfTreeCols.length; i++ )
{
if( ArrayOfTreeCols[i].getAttribute( "sortActive" ) == "true" )
{
treeView.selectedColumn = ArrayOfTreeCols[i].getAttribute( "id" );
treeView.sortDirection = ArrayOfTreeCols[i].getAttribute("sortDirection");
gEventArray.sort(sortEvents);
break;
}
}
document.getElementById( UnifinderTreeName ).view = treeView;
document.getElementById( UnifinderTreeName ).eventView = new calendarEventView( eventArray );

View File

@ -400,15 +400,6 @@ var toDoTreeView =
setTree : function( tree ){this.tree = tree;},
getCellText : function(row,column)
{
var columnElement = document.getElementById(column);
var sortActive = columnElement.getAttribute("sortActive");
if (sortActive == "true")
{
this.selectedColumn = column;
this.sortDirection = columnElement.getAttribute("sortDirection");
gTaskArray.sort(sortTasks);
}
calendarToDo = gTaskArray[row];
if( !calendarToDo )
return;
@ -511,6 +502,19 @@ function refreshToDoTree( taskArray )
toDoTreeView.rowCount = gTaskArray.length;
var ArrayOfTreeCols = document.getElementById( UnifinderTreeName ).getElementsByTagName( "treecol" );
for( var i = 0; i < ArrayOfTreeCols.length; i++ )
{
if( ArrayOfTreeCols[i].getAttribute( "sortActive" ) == "true" )
{
treeView.selectedColumn = ArrayOfTreeCols[i].getAttribute( "id" );
treeView.sortDirection = ArrayOfTreeCols[i].getAttribute("sortDirection");
gTaskArray.sort(sortTasks);
break;
}
}
document.getElementById( ToDoUnifinderTreeName ).view = toDoTreeView;
document.getElementById( ToDoUnifinderTreeName ).taskView = new calendarTaskView( gTaskArray );