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

Enable both client and server-side filtering in Kendo UI

2 Answers 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joakim
Top achievements
Rank 1
Joakim asked on 24 Jun 2013, 02:06 PM
I have stumbled upon a problem using Kendo UI with ASP.NET MVC Wrappers. I am applying intial filters in a extension method on GridBuilder like this:

public static GridBuilder<T> Test<T>(this GridBuilder<T> builder)
where T : class
{
var filters = new List<IFilterDescriptor>();
filters.Add(//adding my filters)

return builder.DataSource(s => s.Server().Filter(f => f.AddRange(filters)));
}

The problem appears when I for example sort a specific column and Kendo creates its query string:

?Grid-sort=FName-desc&Grid-page=1&Grid-pageSize=10&Grid-group=&Grid-filter=

What happens is that Grid-filter= overrides my intial filters causing them to not be applied anymore. The exception is when i apply one of my own filters before Kendo creates its query string, then my filter gets added to the query string and everything is fine and dandy.

Is there a way to prevent Kendo from overriding my intial filters?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 26 Jun 2013, 11:07 AM
Hello Joakim,

Setting the initial state is not supported when using server binding because there is no way to determine if the values are sent as part of the request or are set through the configuration. You should use Ajax binding in order to set predefined filters.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joakim
Top achievements
Rank 1
answered on 26 Jun 2013, 12:12 PM
That's what I expected, problem was solved by re-applying the filters with javascript.
//Joakim Thun
Tags
Grid
Asked by
Joakim
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Joakim
Top achievements
Rank 1
Share this question
or