This question is locked. New answers and comments are not allowed.
I have a Grid that I am trying to pass filterdescriptors to when the page loads. The initial load is server side, then the subsequent loads will be ajax requests.
My Model contains a GridCommand Property, I just don't know how to set the Filters on the view based on the filterdescriptors in the GridCommand.
Has anyone done this?
My Model contains a GridCommand Property, I just don't know how to set the Filters on the view based on the filterdescriptors in the GridCommand.
Has anyone done this?
5 Answers, 1 is accepted
0
Hi,
You should be able to access the filter descriptors in the view and then configure the grid. How to enumerate the filter descriptors is shown in our custom binding demo (check the BindingHelper tab and the ApplyFiltering method).
Regards,
Atanas Korchev
the Telerik team
You should be able to access the filter descriptors in the view and then configure the grid. How to enumerate the filter descriptors is shown in our custom binding demo (check the BindingHelper tab and the ApplyFiltering method).
Regards,
Atanas Korchev
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
0
mike
Top achievements
Rank 1
answered on 23 Jan 2012, 04:01 PM
Atanas,
I would like to do add a the filter descriptors that I set on my Model in the controller for the view so that they are initially set on grid.
Something like the above example.
I would like to do add a the filter descriptors that I set on my Model in the controller for the view so that they are initially set on grid.
.Filterable(filtering => filtering.Filters(filters => filters.AddRange(_model.MyBuGridCommand.FilterDescriptors)))Something like the above example.
0
Hi,
the Telerik team
Unfortunately I have misunderstood your requirements and have mislead you with my previous reply. Please accept my apologies for that.
Currently there is no AddRange method and setting the filter requires an expression e.g.
filters.Add(o => o.ContactName).StartsWith("Paul");
There is a protected collection of FilterDescriptors however which perhaps can be used if made public. Would you like to try a build where this property is exposed so you can set it?
Regards,
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
0
mike
Top achievements
Rank 1
answered on 23 Jan 2012, 04:30 PM
Sure that would be great to have that as public.
0
mike
Top achievements
Rank 1
answered on 24 Jan 2012, 06:14 PM
Atanas, did you find the solution to make the filters public? I changed the properties and tried to set like the following:
The problem I'm running into is that the Filters on a GridCommand are
.Filterable(filtering => new GridFilteringSettings(){Enabled=true, Filters = Model.MyBuGridCommand.FilterDescriptors} )The problem I'm running into is that the Filters on a GridCommand are
IList<IFilterDescriptor> and the Filters on the GridFilteringSettings areList<CompositeFilterDescriptor>. Is there an internal method that will have the grid accept an Ilist of IFilterDescriptors? I imagine this would be similar to when you apply a filter manually during initializing.