Filter on multiple columns?

Mar 26, 2013 at 9:48 PM
Any plans of making it possible to filter on multiple columns?
Coordinator
Mar 27, 2013 at 3:21 AM
Yes,

The main problem is to determine the best way of transfer filter parameters to the server side. Now for one column grid uses fixed query string parameter names, like:

grid-filter-col=columnname&grid-filter-type=1&grid-filter-val=value

For multiple filter columns it is not suitable. May be:

grid-filter-col<num>=columnname&grid-filter-type<num>=1&grid-filter-val<num>=value

Where <num> - autogenerated ordinal number of the column
Mar 27, 2013 at 8:09 AM
Hi Bukharin,

Just the fact that you are thinking about it thrills me. That you can only filter on one column at the time limits the useability of the, otherwise great, grid a bit and I've noticed that it confuses my users.

I understand that a lot of work has to be done and the parameter naming is of course important. I'm a fan of clear names when it comes to parameters and variables. In this case however, it could cause a problem since a URL can only have a certain length and with many columns (with perhaps long names), the longer the parameters, the bigger risk that you hit the URL length limit. perhaps it would be better to name them somethnig like:
g-f-c<num>=columnname&g-f-t<num>=1&g-f-v<num>=value
Coordinator
Mar 27, 2013 at 8:31 AM
Ok, I seems nice idea to short query parameter's names.

But I am also planing to introduce new property of the Grid named, like EnableMultipleFilters, that will be disabled by default. To provide this functionality you will need to enable this feature
Jul 10, 2013 at 2:26 AM
Hi Bukharin!

That's fantastic idea, mate!
Our users are confused about the current filtering as well..

When are you planning to release the multiple columns filtering?
Just an approximate date, please.

Thank you!
Coordinator
Jul 10, 2013 at 4:20 AM
Hi, compros.

It's done in the current version in the repository. Now I am working on others features and I am planing to build beta release of nuget package. I think you can try to use them in a few weeks.
I guess release of 3.0 version within two month.
Jul 25, 2013 at 7:46 PM
I will definitely use this grid once it has "MultipleFilters" capability.

Please let me know as soon as you have a beta.

This grid works like a charm.

Thank you!
Coordinator
Aug 4, 2013 at 2:07 PM
Hi you can install new nuget package Install-Package Grid.Mvc -Pre and try it.
Mar 28, 2014 at 3:25 PM
Hi,Im using Grid.MVC 3.0 version. but i donno how and where to enable the multiple column filters. please help me my project should go live :(
Coordinator
Apr 5, 2014 at 7:25 AM
Use WithMultipleFilters of the grid:
@Html.Grid( .... ).WithMultipleFilters()
Jul 19, 2014 at 9:55 PM
For those using ajax, I had to change gridmvc-ext.js to:
           if (this.options.multiplefilters) { //multiple filters enabled
                for (var i = 0; i < filters.length; i++) {
                    if ($(filters[i]).attr("data-name") != columnName) {
                        var filterData = this.parseFilterValues($(filters[i]).attr("data-filterdata"));
                        if (filterData.length == 0) continue;
                        if (url.length > 0) url += "&";
                        //add '&' between filter items.
                        self.gridColumnFilters += "&"+this.getFilterQueryData($(filters[i]).attr("data-name"), filterData);
                    } else {
                        continue;
                    }
                }
            }
Jul 21, 2014 at 10:37 AM
Hi, I tried it for ajax. It works. Thanks.
Mar 13, 2015 at 1:46 AM
This works. thanks!