PDA

View Full Version : Finding node by text



asagala
11 Jan 2010, 1:46 PM
Is there a way to find a node by text attribute other than going through all the tree nodes? I know I can do it by the id but its not what I want.

I tried this exists = this.get('text'); where this is my treepanel and it didnt work

BlueCamel
11 Jan 2010, 3:25 PM
findChild() from the root node is likely what you want.

jnicora
11 Jan 2010, 3:33 PM
Is there a way to find a node by text attribute other than going through all the tree nodes? I know I can do it by the id but its not what I want.

I tried this exists = this.get('text'); where this is my treepanel and it didnt work

what do you mean by text "attribute" ?

are you looking to find text nodes that match a particular string? You can select childless nodes (including all text nodes), that will reduce the number of elements to match against. Just loop over the select and then check the node type to make sure it's a text node then match it to the string. the selector for childless or "empty" elements is: Ext.select(":empty")

asagala
11 Jan 2010, 3:46 PM
Thanks