I'm using LoadOnDemand with a WebService to load items from a database. I am also using the Filter = "Contains" property, not to filter the results (my web service does that), but to highlight the search term in the result set. With "Contains" the text may be anywhere in the item, so it is a visual cue to see where it matched.
Here is my problem: If someone types in "xyz" and no filter items match, it returns an empty set. I would like to show a message that says "No matches found". One solution I tried was to detect the fact that no items were being returned in the web service, and then inserting a dummy item with the text "No matches found". The problem is this gets filtered out by the control because "No matches found" does not contain "xyz".
I thought of two solutions, but each has me stumped:
1. Using OnClientItemsRequested, if the result set is 0 items, then turn off filtering so that the message will show. The turn filtering back on next time OnClientItemsRequested is called. I can't seem to control the filter property with javascript though.
2. Use the RadComboBoxData.Message property to say "No matches found", but this doesn't appear when I send my result back from the web service. I don't know if I'm doing it wrong, or if the filter is hiding it, or if that only works with virtual scrolling.
I am also open to other solutions. I would rather not change the user's text input however. For example, if they type "xyz" and there are no matches, I don't want to clear their "xyz" entry and show the message in the box. Maybe they made a typo and just need to backspace and correct it. If we clear it, I think it will be confusing.
I look forward to your advice! Thank you.
Here is my problem: If someone types in "xyz" and no filter items match, it returns an empty set. I would like to show a message that says "No matches found". One solution I tried was to detect the fact that no items were being returned in the web service, and then inserting a dummy item with the text "No matches found". The problem is this gets filtered out by the control because "No matches found" does not contain "xyz".
I thought of two solutions, but each has me stumped:
1. Using OnClientItemsRequested, if the result set is 0 items, then turn off filtering so that the message will show. The turn filtering back on next time OnClientItemsRequested is called. I can't seem to control the filter property with javascript though.
2. Use the RadComboBoxData.Message property to say "No matches found", but this doesn't appear when I send my result back from the web service. I don't know if I'm doing it wrong, or if the filter is hiding it, or if that only works with virtual scrolling.
I am also open to other solutions. I would rather not change the user's text input however. For example, if they type "xyz" and there are no matches, I don't want to clear their "xyz" entry and show the message in the box. Maybe they made a typo and just need to backspace and correct it. If we clear it, I think it will be confusing.
I look forward to your advice! Thank you.