Hello,
When I filter on the RadDropDownTree then backspace everything I typed in the filter field it expands all the nodes on the tree.
What I want it to do is collapse all the nodes as if I'm starting at the very beginning.
Peter Milchev gave me a nice working script from my last filter question. I'm posting it here. Perhaps it can be modified?
Thanks!
--Clark
<script>
var $T = Telerik.Web.UI;
Telerik.Web.UI.RadDropDownTree.Manager.prototype._filterNodes = function (text) {
var nodes = this._embeddedTree.get_allNodes(),
count = nodes.length,
regEx,
i;
if (this._filter == $T.DropDownTreeFilter.StartsWith)
regEx = new RegExp("^\\s*" + $T.RadDropDownTree.Manager._regExEscape(text), "im");
else
regEx = new RegExp($T.RadDropDownTree.Manager._regExEscape(text), "gim");
for (i = 0; i < count; i++) {
var currentNode = nodes[i];
var matchIsFound;
if (currentNode.get_level() !== 2) {
matchIsFound = false;
} else {
matchIsFound = this._matchNode(currentNode, text, regEx);
}
if (matchIsFound) {
this._handleVisibleParents(currentNode);
this._filteredVisibleNodes.push(currentNode);
}
else {
this._handleHiddenNode(currentNode);
}
}
this._hideNodes(this._filteredHiddenNodes);
this._showNodes(this._filteredVisibleNodes);
this._filteredVisibleNodes = [];
this._filteredHiddenNodes = [];
}
</script>
I wanted to clarify that this behavior I want to modify is default behavior. It's not related to the script I posted.
Default Behavior: When I backspace everything I typed in the filter field, the dropdown tree expands every node.
I want it to collapse every node in the tree.