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

filter="contains" filters out separator

1 Answer 133 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 20 Jun 2014, 03:46 PM
I have a combo box that is loading its data from a webservice. When the user types in some letters the webservice uses these as a filter and returns only rows that match (using a "contains" sql call). This all works well.

I have also set "filter=contains" on the combobox so that the matching part of the filter is highlighted in the dropdown list. This looks very nice.

However, if the webservice finds no items because the filter eliminates all data (maybe the user types in ZZZZZ) then the webservice returns a single radcombobox item with value="" and text="Sorry, no match found". I also mark this item with "IsSeparator = True" so that I can style it appropriately on the client.

The problem is that the "filter=contains" filters out the "Sorry, no match found" item because it doesn't match the text "ZZZZZ"! So the user never sees my friendly message, they just get an empty dropdownlist.

If I turn off the filter=contains then the friendly message shows, but obviously I lose the highlighting in the dropdown to show how the user's input is matching up with the items in the list.

Is there a way to make the client-side "filter=contains" filter out everything except a certain item, or everything except separators?

1 Answer, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 24 Jun 2014, 01:40 PM
Hello John,

Did you try to use the "ShowMoreResultsBox"  property of RadComboBox like in the example:
http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx?

It shows "No matches" if there are not items in dropdown.


Regards,
Helen
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
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
Helen
Telerik team
Share this question
or