Search on item full description but only display item number

5 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 17 Apr Link to this post

    I have an radautocompletebox with a list of forms, I want to be able to search on the form number or name, but for space purposes only display the form number once a form is selected.

    I have a list of form objects with these properties:

    Value = "001"
    Display = "Identification Card"
    ValueDisplay  = "001-Identification Card"

    The autocomplete box:

    TextSearchPath = "Value"
    DisplayPath = "ValueDisplay"

    This shows the ValueDisplay in the dropdown and selects Value when selected but it does not allow for searching on the form name (Display).

    Is there a way to allow searching on ValueDisplay but only show Value when selected?

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Apr Link to this post

    Hi Kenneth,

    You will need to set TextSearchPath to "ValueDisplay" as this is the property set for searching and DisplayPath to "Value" as this sets what's displayed when an item is selected.

    Additionally, if you'd like to search on two properties at the same time, you will need to implement custom FilteringBehavior as explained in the Filtering Behavior topic inside our documentation. You could also take a look at the TwoPropertiesFilteringBehavior SDK example in our XAML Repository.


    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
  4. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 18 Apr in reply to Yana Link to this post

    At first I had it set up exactly how you said, with TextSearchPath="ValueDisplay" and DisplayPath="Value".

    I have 2 examples with screen shots; example 1 has tsp=value and dp=valuedisplay, example 2 has them switched, see the results:

    Example 1:
     
    <telerik:RadAutoCompleteBox   DisplayMemberPath="ValueDisplay"
                                            TextSearchPath="Value"
                                            AutoCompleteMode="SuggestAppend"
                                            TextSearchMode="Contains"
                                            SelectionMode="Single"
                                            WatermarkContent="Enter Form Number(s)..."/>
     
    Example 2:
     
    <telerik:RadAutoCompleteBox   DisplayMemberPath="Value"
                                            TextSearchPath="ValueDisplay"
                                            AutoCompleteMode="SuggestAppend"
                                            TextSearchMode="Contains"
                                            SelectionMode="Single"
                                            WatermarkContent="Enter Form Number(s)..."/>

  5. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 18 Apr in reply to Kenneth Link to this post

    Additionally, when I SelectionMode to Multiple it gets odd, see example 3 code and screen shot:

    Example 3:
     
                <telerik:RadAutoCompleteBox  DisplayMemberPath="Value"
                                            TextSearchPath="ValueDisplay"
                                            AutoCompleteMode="SuggestAppend"
                                            TextSearchMode="Contains"
                                            SelectionMode="Multiple"
                                            WatermarkContent="Enter Form Number(s)..."/>

  6. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 18 Apr in reply to Kenneth Link to this post

    RESOLVED

    I was able to get the desired results by setting the TestSearchPath to Value, omitting DisplayMemberPath and instead using a DropDownItemTemplate to disply a custom list and a also adding a custom FilteringBehaviour to search two fields.

    I still believe that the default behaviour isincorrect but with the ability to have a custom dropdowntemplate and custom filtering its a moot point.

    Thanks

Back to Top
DevCraft banner