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

IQueryable Grid Data

1 Answer 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Deyan
Top achievements
Rank 1
Deyan asked on 31 Mar 2011, 12:31 PM
Hello,

We are trying to add post filtering of the data that is sent to the grid via ajax.

Something like this:

ActionResult Action(GridCommand command)
{
var data = (IQueryable)repository.GetAll();

IQueryable tmpData = ToQueryable(data, command);

IEnumerable postFilteredData = tmpData.Select(....);

return View(new GridModel
{
Data = postFilteredData
});
}

For this to accomplish we need an IQueryable object after the internal Grid filtering. It will be great if you can add a new extension in Telerik.Web.MVC.Extensions.  

The extension should be like the following, but to return IQueryable instead, just like the second group.
public static GridModel ToGridModel(queryable, page, pageSize, sortDescriptors, filterDescriptors, groupDescriptors);


public static IQueryable ToQueryable(queryable, gridCommand);
or
public static IQueryable ToQueryable(queryable, page, pageSize, sortDescriptors, filterDescriptors, groupDescriptors);

Thank you in advance!

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 31 Mar 2011, 01:08 PM
Hi Deyan,

 You can easily cast the Data property of GridModel back to IQueryable<T>. It should work without a glitch. 

Regards,
Atanas Korchev
the Telerik team
Tags
Grid
Asked by
Deyan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or