Fix itemTreeView.getSortField() and getSortDirection() if no column selected -- this was breaking report generation on initial installs

This commit is contained in:
Dan Stillman 2007-01-05 20:50:40 +00:00
parent 593c3c1128
commit 8e4de076d1

View File

@ -840,14 +840,24 @@ Zotero.ItemTreeView.prototype.getSortedItems = function() {
}
Zotero.ItemTreeView.prototype.getSortField = function() {
var col = this._treebox.columns.getSortedColumn().id;
var column = this._treebox.columns.getSortedColumn()
if (!column) {
return false;
}
// zotero.items._________.column
return col.substring(13, col.length-7);
return column.substring(13, column.length-7);
}
/*
* Returns 'ascending' or 'descending'
*/
Zotero.ItemTreeView.prototype.getSortDirection = function() {
return this._treebox.columns.getSortedColumn().element.getAttribute('sortDirection');
var column = this._treebox.columns.getSortedColumn();
if (!column) {
return 'ascending';
}
return column.element.getAttribute('sortDirection');
}