Closes #437, ability to get sorted contents of selected collection/saved search

ZoteroPane.getSortedItems() -- return array of item ids of visible items in current sort order
This commit is contained in:
Dan Stillman 2007-01-02 11:46:17 +00:00
parent aec015c039
commit 0f818079bd
2 changed files with 24 additions and 0 deletions

View File

@ -54,6 +54,7 @@ var ZoteroPane = new function()
this.getSelectedCollection = getSelectedCollection;
this.getSelectedSavedSearch = getSelectedSavedSearch;
this.getSelectedItems = getSelectedItems;
this.getSortedItems = getSortedItems;
this.getSortField = getSortField;
this.getSortDirection = getSortDirection;
this.buildCollectionContextMenu = buildCollectionContextMenu;
@ -762,6 +763,18 @@ var ZoteroPane = new function()
}
/*
* Returns an array of item ids of visible items in current sort order
*/
function getSortedItems() {
if (!itemsView) {
return false;
}
return itemsView.getSortedItems();
}
function getSortField() {
if (!itemsView) {
return false;

View File

@ -771,6 +771,17 @@ Zotero.ItemTreeView.prototype.rememberSelection = function(selection)
}
}
/*
* Returns an array of item ids of visible items in current sort order
*/
Zotero.ItemTreeView.prototype.getSortedItems = function() {
var ids = [];
for each(var item in this._dataItems) {
ids.push(item.ref.getID());
}
return ids;
}
Zotero.ItemTreeView.prototype.getSortField = function() {
var col = this._treebox.columns.getSortedColumn().id;
// zotero.items._________.column