This project is read-only.

Filtering based on values in the grid?

Jan 29, 2014 at 3:14 PM
Is there a way of requesting the filter creates a select list based on the values in that field?

I have around 50 grids.. with lots of fields in each. I really dont want to create a custom filter per one.

I was hoping there is a feature i dont know about..

i.e. if i have a table that looks like
employee    |  activity  |  Source
Mrs K            New        Paper
Mrs M            Edit       Email
Mrs K            Canc       Email
Mrs K            New        Phone
Mrs M            Canc       Phone
I would expect the employee filter to let me select from Mrs K or Mrs M
I would expect the activity filter to let me select from New,Edit or Canc
I would expect the activity filter to let me select from Paper,Email or Phone

I suppose I am looking for something like..

@Html.Grid(Model.MyRandomCollection, GridRenderOptions.Create("MyRandomGrid")).Columns(columns =>
columns.Add(c => c.employee   )
        .Titled("employee   ")
    columns.Add(c => c.activity  )
        .Titled("activity  ")
    columns.Add(c => c.Source)
Is this possible?
Jan 30, 2014 at 2:51 AM

Unfortunately, there is no built in functionallity to do that. There main problem is that grid may have a paging and only server side knows all options in your column (you need to make DISTINCT request)

You can create own filter widget for that and reuse it in each grid like:
columns.Add(c => c.employee).SetFilterWidgetType("MyFilterWidget")