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

Search on item full description but only display item number

4 Answers 69 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 2
Iron
Kenneth asked on 17 Apr 2016, 05:42 PM

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?

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 18 Apr 2016, 12:18 PM
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.
0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2016, 12:57 PM

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)..."/>

0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2016, 01:11 PM

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)..."/>

0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2016, 02:41 PM

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

Tags
AutoCompleteBox
Asked by
Kenneth
Top achievements
Rank 2
Iron
Answers by
Yana
Telerik team
Kenneth
Top achievements
Rank 2
Iron
Share this question
or