This is a migrated thread and some comments may be shown as answers.

Wildcard support?

3 Answers 151 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 07 Aug 2014, 06:35 PM
does the treeview findByText method support wildcards?
For example:
searchText = "Qrtly0422"
item = treeview.findByText(searchText)
dataItem = treeview.dataItem(item)
nodeText = dataItem.text

I can find the exact node, no problem, but if I try searchText = "422" it fails to find a result but doesn't throw any errors

I noticed the datasource filter can take an operator ie:  treeview.dataSource.filter({ field: "text", operator: "contains", value: nodeText })

so I tried to pass that structure to the findByText method but item will equal 0 and then the rest of the code fails with null errors.
item = treeview.findByText({ field: "text", operator: "contains", value: searchText })

Thanks.

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 11 Aug 2014, 11:44 AM
Hello Ryan,

I am afraid that the findByText does not support wildcards - it uses jQuery and searches for exact matches only. The behavior you described could be achieved using a custom solution, as shown in this example.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ryan
Top achievements
Rank 1
answered on 11 Aug 2014, 02:24 PM
This example is pretty close to what I needed, but I have a couple more questions..

Any idea why searching for just the letter o is matching [ pdf, prices.pdf, zip] ? I would have expected images to be matched as well if it was including parent nodes as well.

is there an easy way to exclude the branches from being searched and only look at the leaves?

Thank you
0
Alexander Popov
Telerik team
answered on 13 Aug 2014, 10:27 AM
Hi Ryan,

This happens because the parent node contains the letter "o" and the CSS styles propagate to the children. Searching only the leaf nodes is possible, however this is all done using jQuery selectors, which are beyond the scope of our support services, as they are not directly related to Kendo UI.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
Ryan
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or