fix for 55791 a=ben

git-svn-id: svn://10.0.0.236/trunk@85079 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2001-01-18 08:24:42 +00:00
parent b4abc5b28a
commit df4db85560
3 changed files with 30 additions and 7 deletions

View File

@@ -31,6 +31,9 @@ function HistoryInit() {
if (children.firstChild)
tree.selectItem(children.firstChild);
tree.focus();
// do a sort
RefreshSort();
}
var historyDNDObserver = {

View File

@@ -68,41 +68,43 @@
<treecolgroup id="theColumns">
<treecol flex="4" id="Name"
sortSeparators="true" persist="hidden width"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="4" id="URL"
sortSeparators="true" persist="hidden width"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#URL"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Date"
sortSeparators="true" persist="hidden width"
<treecol flex="1" id="Date" sortActive="true" sortDirection="descending"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Date"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="FirstVisitDate"
sortSeparators="true" persist="hidden width"
hidden="true"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#FirstVisitDate"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Referrer"
sortSeparators="true" persist="hidden width"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Referrer"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="VisitCount"
sortSeparators="true" persist="hidden width"
hidden="true"
sortSeparators="true" persist="hidden width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#VisitCount"
resource2="http://home.netscape.com/NC-rdf#Name"/>

View File

@@ -89,6 +89,15 @@ function doSort(sortColName, naturalOrderResource)
return true;
}
// re-does a sort based on the current state
function RefreshSort()
{
var current_column = find_sort_column();
var current_direction = find_sort_direction(current_column);
sort_column(current_column, current_direction);
}
// set the sort direction on the currently sorted column
function SetSortDirection(direction)
{
var current_column = find_sort_column();
@@ -98,6 +107,7 @@ function SetSortDirection(direction)
}
}
// set the sorted column
function SetSortColumn(column_name)
{
var current_column = find_sort_column();
@@ -108,6 +118,7 @@ function SetSortColumn(column_name)
}
}
// actually sort given the column and direction
function sort_column(column, direction)
{
var isupports_uri = "@mozilla.org/rdf/xul-sort-service;1";
@@ -128,6 +139,7 @@ function sort_column(column, direction)
return false;
}
// search over the columns to find the first one with an active sort
function find_sort_column() {
var columns = document.getElementById('theColumns');
var column = columns.firstChild;
@@ -141,6 +153,7 @@ function find_sort_column() {
}
// get the sort direction for the given column
function find_sort_direction(column) {
if ("true" == column.getAttribute('sortActive')) {
return column.getAttribute('sortDirection');
@@ -149,6 +162,11 @@ function find_sort_direction(column) {
}
}
// set up the menu items to reflect the specified sort column
// and direction - put check marks next to the active ones, and clear
// out the old ones
// - disable ascending/descending direction if the tree isn't sorted
// - disable columns that are not visible
function update_sort_menuitems(column, direction)
{
var unsorted_menuitem = document.getElementById("unsorted_menuitem");