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

How do I disable client-side filtering for AutoComplete?

7 Answers 99 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shane Milton
Top achievements
Rank 2
Shane Milton asked on 17 Jan 2011, 10:05 PM
It seems to me that client-side filtering is forced upon me and my only options are BeginsWith and Contains. This is unacceptable as I have server-side filtering implemented and that filtering ends up searching amongst many different columns, not all of which are being returned to the client.

For example, let's say I have a list of places. My filtering searches both States and Countries tables in the database and searches both on name, abbreviation, default language, official bird, or official tree. I obviously don't want/need to send all of this data back, so I should be able to search on "Buckeye" and get "Ohio" back, even though "Buckeye" is not in the text "Ohio" that the AutoComplete control gets back. Or let's say I'm doing an Soundex query in SQL Server - this isn't even anything close to something I can put into an AutoComplete control, as far as I'm aware.

In all scenarios where it's affecting me, my JsonResult is exactly what I expect it to be but I always see a subset (often times 0 of those items) because it appears the AutoComplete control removes items that my server tells it to bind to.

Can we have a "None" filtering option, please?

7 Answers, 1 is accepted

Sort by
0
Shane Milton
Top achievements
Rank 2
answered on 17 Jan 2011, 10:28 PM
For now, I'm using a ComboBox which allows me to turn off a client-side filter. This functions fine for me (although I don't want the dropdown arrow). Can we get this to be possible for the AutoComplete as well, please?
0
Georgi Krustev
Telerik team
answered on 18 Jan 2011, 01:40 PM
Hello Shane Milton,

Thank you for your feedback.

Our current plans does not include implementing this functionality. Nevertheless I will forward your suggestion to our developers for further investigation and collaboration. 

Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shane Milton
Top achievements
Rank 2
answered on 19 Jan 2011, 03:46 PM
Really? It seems rather silly to me for all of these controls to not function the same as it pertains to handling data. Seems more difficult for Telerik to maintain and much more confusing and frustrating to your users. At least I have a good-enough solution although it looks somewhat unprofessional.

If you could provide some css that hides the dropdown arrow of a ComboBox to force it to look like an AutoComplete, that would help. I've hidden the dropdown arrow but there are some side-effects and I'm still stuck with some gray padding/margin or something that I can't figure out how to get rid of without causing other problems.

Many thanks, Georgi!
-Shane
0
Georgi Krustev
Telerik team
answered on 20 Jan 2011, 08:42 AM
Hello Shane,

We have created PITS item  for the suggested functionality. You can vote for it. Depending on the interests we will decide whether to implement it.

If you still need to use AutoComplete UI component you can try this workaround, which will stop client-side filtering:

autocompleteLoad(e){
 var autocomplete = $(this).data('tAutoComplete');
  
 autocomplete.filter = 0;
 autocomplete.selectedIndex = 0;
 autocomplete.filters[0] = function(component) {
   if (!component.dropDown.$items) {
      component.dataBind(component.data, true /*if you need to preserve input content*/);
   }
 }
}
As you probably noticed you need to wire load event of the component to this event handler.

Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mattias
Top achievements
Rank 1
answered on 26 Oct 2011, 01:19 PM
Hi,
I really need this functionality to.
I want to search in multiple columns in the database but showing only one column in the autocomplete control.

/Mattias
0
Mattias
Top achievements
Rank 1
answered on 26 Oct 2011, 01:33 PM
Hi again,
I tried the workaround above but it's not working as it should.
I'm just able to make one search. If I try another search phrase nothing happens and I need to reload the whole page to be able to search again.

/Mattias
0
Georgi Krustev
Telerik team
answered on 28 Oct 2011, 12:48 PM
Hello Mattias,

 
In order to achieve your goal, you will need to turn off the cache like so:

.DataBinding(binding => binding.Ajax().Select("_AutoCompleteAjaxLoading", "ComboBox").Cache(false))

Also you will need to bind autocomplete everytime on filter:
function autocompleteLoad(e){
         var autocomplete = $(this).data('tAutoComplete');
   
         autocomplete.filter = 0;
         autocomplete.filters[0] = function(component) {
            component.dataBind(component.data, true /*if you need to preserve input content*/);
         }
    }

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
ComboBox
Asked by
Shane Milton
Top achievements
Rank 2
Answers by
Shane Milton
Top achievements
Rank 2
Georgi Krustev
Telerik team
Mattias
Top achievements
Rank 1
Share this question
or