Wildcard support?

4 posts, 0 answers
  1. Ryan
    Ryan avatar
    4 posts
    Member since:
    Dec 2013

    Posted 07 Aug 2014 Link to this post

    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.
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 11 Aug 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Ryan
    Ryan avatar
    4 posts
    Member since:
    Dec 2013

    Posted 11 Aug 2014 Link to this post

    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
  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 13 Aug 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready