зеркало из https://github.com/mozilla/gecko-dev.git
Add sorting on address book columns
This commit is contained in:
Родитель
c0b9d968ca
Коммит
fd6853ad8c
|
@ -140,3 +140,39 @@ function ResultsPaneSelectionChange()
|
|||
}
|
||||
}
|
||||
|
||||
function SortResultPane(column, sortKey)
|
||||
{
|
||||
var node = document.getElementById(column);
|
||||
if(!node)
|
||||
return false;
|
||||
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
rdfCore.Init("RDFCore");
|
||||
|
||||
}
|
||||
|
||||
// sort!!!
|
||||
sortDirection = "ascending";
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "ascending";
|
||||
else sortDirection = "ascending";
|
||||
|
||||
rdfCore.doSort(node, sortKey, sortDirection);
|
||||
|
||||
return(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,9 +63,9 @@ Rights Reserved.
|
|||
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell>&nameColumn.label;</treecell>
|
||||
<treecell>&emailColumn.label;</treecell>
|
||||
<treecell>&phoneColumn.label;</treecell>
|
||||
<treecell onclick="return top.SortResultPane('NameColumn', 'http://home.netscape.com/NC-rdf#DisplayName');">&nameColumn.label;</treecell>
|
||||
<treecell onclick="return top.SortResultPane('EmailColumn', 'http://home.netscape.com/NC-rdf#PrimaryEmail');">&emailColumn.label;</treecell>
|
||||
<treecell onclick="return top.SortResultPane('WorkPhoneColumn', 'http://home.netscape.com/NC-rdf#WorkPhone');">&phoneColumn.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче