This is a migrated thread and some comments may be shown as answers.
Is it possible to change RadComboBox Filter on the client side?
5 Answers 66 Views
This is a migrated thread and some comments may be shown as answers.
Water
Top achievements
Rank 1
Water asked on 02 Dec 2013, 12:19 PM
I want the user to be able to change the Filter option between StartsWith and Contains by using a couple of radio buttons. Is it possible to do this client side or do I have to do a postback to change this setting?

5 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 03 Dec 2013, 09:11 AM
Hello Water,

You could use the set_filter() client-side function, in order to apply a desirable filter. The function accepts tree values as arguments :

  • 0 : filter - None
  • 1 : filter - Contains
  • 2 : filter - StartsWith

Regards,
Nencho
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Water
Top achievements
Rank 1
answered on 03 Dec 2013, 12:44 PM
Thanks for that. I created a function using the set_filter method however this only seems to effect what text is highlighted in the search results, rather than what search results are returned, am I missing something?

function SetComboBoxSearchFilter(comboBoxClientId, filterNumber)
{
    var comboBox = $find(comboBoxClientId);
    comboBox.set_filter(filterNumber);
 
    if (comboBox.get_text() != '' && comboBox.get_text() != comboBox.get_emptyMessage())
    {
        comboBox.clearItems();
        comboBox.requestItems(comboBox.get_text(), false);
    }
}
0
Nencho
Telerik team
answered on 06 Dec 2013, 09:40 AM
Hello Water,

I tried the approach that you are currently using and it seems to work properly. Here is a video, demonstrating the behavior at my end, when the StartsWith(2) is used. I noticed that you are using requestItems function. Had you enabled the LoadOnDemand functionality? In this case, I would suggest you to implement the filter at server-side, like demonstrated in our online demo here. Passing the currently typed text in the input of the ComboBox, you could then easily filter the query returned for your datasource, like demonstrated in the SourceCode of the referenced demo (Product ComboBox).

Regards,
Nencho
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Water
Top achievements
Rank 1
answered on 09 Dec 2013, 10:29 AM
Yes, I am using Load On Demand. Would this prevent the client side method from working correctly? In any case, I have the server side method working, I was just trying to reduce the number of postbacks.
0
Nencho
Telerik team
answered on 12 Dec 2013, 09:12 AM
Hello Water,

Would you provide us with your entire implementation of the RadComboBox and specify how do you attempt to reduce the number of postbacks? By default the ItemsRequested event is fired each time a character is typed in the input of the control. Do you cancel the propagation of the event, in order to implement custom logic?

Regards,
Nencho
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Water
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Water
Top achievements
Rank 1
Share this question
or