Using the .empty? method (which just in turn calls .count) before the grid is displayed generates a grid with all filters ignored.
The code below generates a grid which works completely normally, including attribute filters in the view.
class EventsController < AdminController
def index
@events_grid = initialize_grid(Event)
end
end
However, referencing .empty? on the grid renders all the filters inactive. If the index method is changed to look like this:
def index
@events_grid = initialize_grid(Event)
@events_grid.empty?
end
The grid still displays as normal, but any filters on attributes are ignored (despite the correct URL params being set). It's worth noting that the sort is still preserved.
Using the .empty? method (which just in turn calls .count) before the grid is displayed generates a grid with all filters ignored.
The code below generates a grid which works completely normally, including attribute filters in the view.
However, referencing .empty? on the grid renders all the filters inactive. If the index method is changed to look like this:
The grid still displays as normal, but any filters on attributes are ignored (despite the correct URL params being set). It's worth noting that the sort is still preserved.
I suspect that the option :forget_generated_options in wice_grid.rb may be to blame: https://github.com/leikind/wice_grid/blob/rails3/lib/wice_grid.rb#L394