ENHANCEMENT: removed the situation, when the user is left with empty search box and empty dropdown.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97793 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Mateusz Uzdowski 2010-01-29 01:46:45 +00:00 committed by Sam Minnee
parent 4939a0a4dc
commit b34315a35d

View File

@ -114,8 +114,6 @@ TreeDropdownField.prototype = {
saveCurrentState: function() { saveCurrentState: function() {
this.origHumanText = this.getHumanText(); this.origHumanText = this.getHumanText();
this.defaultCleared = false;
this.searched = false;
}, },
restoreOriginalState: function() { restoreOriginalState: function() {
@ -324,7 +322,7 @@ TreeDropdownField.prototype = {
} }
if (!this.treeDropdownField.treeShown) this.treeDropdownField.toggleTree(); if (!this.treeDropdownField.treeShown) this.treeDropdownField.toggleTree();
if (!this.treeDropdownField.defaultCleared) { if (!this.treeDropdownField.defaultCleared || !this.treeDropdownField.searched) {
this.treeDropdownField.defaultCleared = true; this.treeDropdownField.defaultCleared = true;
this.treeDropdownField.setHumanText(''); this.treeDropdownField.setHumanText('');
} }
@ -338,7 +336,8 @@ TreeDropdownField.prototype = {
if(this.tree.selected && this.tree.selected.removeNodeClass) this.tree.selected.removeNodeClass('current'); if(this.tree.selected && this.tree.selected.removeNodeClass) this.tree.selected.removeNodeClass('current');
this.addNodeClass('current'); this.addNodeClass('current');
this.tree.selected = this; this.tree.selected = this;
this.options.dropdownField.searched = false;
} }
} }