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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102533 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 23:38:57 +00:00
parent c24c9c89a2
commit b9c0a14ecc

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() {
@ -327,7 +325,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('');
} }
@ -341,7 +339,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;
} }
} }