This project is read-only.

How to retrieve the result set the grid filters

Oct 7, 2013 at 12:31 PM

thank you for a great plug-in! I have an issue using it though. There does not seem to be a way to retrieve the IQueryable the grid constructs after applying filters.

Is it possible to do so? If it is - how?

Oct 7, 2013 at 6:08 PM

Why you need to retrieve the IQueryable?

You can create IGridItemsProcessor<T> implementation and add your processor to the grid processors queue, using AddItemsProcessor of Grid<T> class. This interface has only one method:
IQueryable<T> Process(IQueryable<T> items);
Grid pass the IQueryable and wait for processed collection.
public class MyItemsProcessor<T>: IGridItemsProcessor<T> where T : class
    public IQueryable<T> Process(IQueryable<T> items)
        //Do something
        return items;
This is feature not documented yet
Oct 8, 2013 at 9:12 AM
Thank you for the swift response.

The code you have posted allows the user to do further processing, after the grid does its thing. Works like a charm if you want to simply display the data. however, consider this case: The user wants to filter a set of objects. After all filters are applied he can see the results, but he cannot export them anywhere (be it an *.xls file or some other system) hence there is no way to retrieve the filtered set of items. Of course there is always parsing the URI and creating a query, filtering the result set in the same way the grid does, but that would be just re-creating the functionality of the grid itself.

So is it possible to retrieve the filtered results for further processing (make it data export, data logging or similar)?
Oct 8, 2013 at 10:32 AM

Grid<T> class allready has property that you need, but its mark as private:
IQueryable<T> GridItems
I made a commit to fix this issue:
I'll include this fix in the next release. now you can install new package version:
Install-Package Grid.Mvc -Pre
Oct 8, 2013 at 2:20 PM
Thank you very much for a quick solution. Keep up the god work with the plug-in! :)