Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I am using extjs in my application. I have created the treeview and I want to implement advance search in tree view. When I type letter in textbox it search in last level childes of treeview  without expanding the tree view and if search fulfil then make node visible otherwise hide that node. Currently it search only in root level nodes.
It can not search in childes of tree until we expand the tree view.
Please help me.


What I have tried:

onLibraryFilterChange: function(b) {
var a = b.getValue() ? b.getValue().toLowerCase().trim() : "";
this.getLibraryTree().getRootNode().cascadeBy(function(f) {
var g = f.data.name ? f.data.name.toLowerCase() : "";
if (f.data.type === "song") {
if (f.data.title && f.data.title.length > 0) {
g = f.data.title.toLowerCase()
}
if (f.data.artist && f.data.artist.length > 0) {
g += " " + f.data.artist.toLowerCase()
}
}
var e = this.getView().getNodeByRecord(f);
var d;
var c;
if (f.parentNode) {
d = this.getView().getNodeByRecord(f.parentNode);
if (f.parentNode.parentNode) {
c = this.getView().getNodeByRecord(f.parentNode.parentNode)
}
}
if (e) {
if (g.indexOf(a) == -1) {
e.hidden = true
} else {
e.hidden = false;
if (d) {
d.hidden = false
}
if (c) {
c.hidden = false
}
}
}

}, this.getLibraryTree())

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900