Thanks for that - it's what I ended up doing:
RCS.StationPicker.prototype.filterNodes = function(searchTerm,
targetNode)
{
// Only show nodes matching the specified search term
var startNode = targetNode ||
this.availableStationsTree.dynatree("getRoot");
startNode.visit(function(node)
{
if (node.isVisible() && node.data.title)
{
// Filter currently visible non-root nodes.
if (node.data.title.indexOf(searchTerm) >= 0)
{
// Make sure we and all our parents are visible
node.visitParents(function(node)
{
$(
node.li).show();
return (node.parent != null);
}, true);
// Terminate the traversal of this branch since the
node matches
return 'skip';
}
else
{
// Hide the node.
$(
node.li).hide();
}
}
});
}