Fix clearing selected tag when removed from last item in view

I somehow broke this in d2f028d797, though
I'm not sure how.
This commit is contained in:
Dan Stillman 2013-03-14 20:06:34 -04:00
parent d60b0221db
commit 4e1fbf9747

View file

@ -279,6 +279,14 @@
break; break;
} }
} }
// If tag isn't in scope and is still selected,
// deselect it
if (!inScope && self.selection[labels[i].value]) {
labels[i].setAttribute('selected', false);
delete self.selection[labels[i].value];
var doCommand = true;
}
} }
// If not in filter, hide // If not in filter, hide
@ -303,16 +311,6 @@
} }
else { else {
labels[i].setAttribute('inScope', false); labels[i].setAttribute('inScope', false);
// If out of scope, make sure it's not selected (otherwise a tag
// stays selected after removing an item with that tag from the
// current collection)
if (self.selection[labels[i].value]) {
labels[i].setAttribute('selected', false);
delete self.selection[labels[i].value];
var doCommand = true;
}
} }
labels[i].setAttribute('hidden', false); labels[i].setAttribute('hidden', false);