Revert "Don't refresh item list upon tag selector actions unless the action changes the item list."

This reverts commit 7f732f56df.
This commit is contained in:
Simon Kornblith 2013-01-22 17:25:50 -05:00
parent b3640a8ae1
commit 39e8b226cb
3 changed files with 4 additions and 18 deletions

View file

@ -2198,19 +2198,14 @@ Zotero.ItemGroup.prototype.getChildTags = function() {
Zotero.ItemGroup.prototype.setSearch = function(searchText) Zotero.ItemGroup.prototype.setSearch = function(searchText)
{ {
if(searchText === this.searchText) return false;
Zotero.ItemGroupCache.clear(); Zotero.ItemGroupCache.clear();
this.searchText = searchText; this.searchText = searchText;
return true;
} }
Zotero.ItemGroup.prototype.setTags = function(tags) Zotero.ItemGroup.prototype.setTags = function(tags)
{ {
if((!tags || Zotero.Utilities.isEmpty(tags))
&& (!this.tags || Zotero.Utilities.isEmpty(this.tags))) return false;
Zotero.ItemGroupCache.clear(); Zotero.ItemGroupCache.clear();
this.tags = Zotero.Utilities.deepCopy(tags); this.tags = tags;
return true;
} }
/* /*

View file

@ -1733,18 +1733,16 @@ Zotero.ItemTreeView.prototype.setFilter = function(type, data) {
var savedOpenState = this.saveOpenState(); var savedOpenState = this.saveOpenState();
var savedFirstRow = this.saveFirstRow(); var savedFirstRow = this.saveFirstRow();
var isDirty;
switch (type) { switch (type) {
case 'search': case 'search':
isDirty = this._itemGroup.setSearch(data); this._itemGroup.setSearch(data);
break; break;
case 'tags': case 'tags':
isDirty = this._itemGroup.setTags(data); this._itemGroup.setTags(data);
break; break;
default: default:
throw ('Invalid filter type in setFilter'); throw ('Invalid filter type in setFilter');
} }
if(!isDirty) return false;
var oldCount = this.rowCount; var oldCount = this.rowCount;
this.refresh(); this.refresh();
@ -1759,7 +1757,6 @@ Zotero.ItemTreeView.prototype.setFilter = function(type, data) {
//Zotero.debug('Running callbacks in itemTreeView.setFilter()', 4); //Zotero.debug('Running callbacks in itemTreeView.setFilter()', 4);
this._runCallbacks(); this._runCallbacks();
return true;
} }

View file

@ -1037,13 +1037,7 @@ var ZoteroPane = new function()
*/ */
function updateTagFilter(){ function updateTagFilter(){
if (this.itemsView) { if (this.itemsView) {
// If setFilter returns false, that means the tags didn't change. In that this.itemsView.setFilter('tags', getTagSelection());
// case, callbacks don't get called, so we need to update tags in the tag
// selector on our own.
if(!this.itemsView.setFilter('tags', getTagSelection())) {
var tagSelector = document.getElementById('zotero-tag-selector');
tagSelector.refresh();
}
} }
} }