bogdan / datagrid

Gem to create tables grids with sortable columns and filters
MIT License
1.02k stars 115 forks source link

Link to grid with specific filter enabled #290

Closed Ellerden closed 4 years ago

Ellerden commented 4 years ago

Hi! I have a Candidates grid with several filters (one is "Followed" - indicating that User is subscribed to the candidate). On another, Notifications page, I need to have a link to CandidatesGrid with 'Followed' filter enabled. Any suggestions on how to do that? Didn't see how to refer to the specific filter in docs. Thanks in advance.

bogdan commented 4 years ago

Hey,

You can do it like this:

<% grid  = CandidatesGrid.new(followed: true) %>
<a href="<%= whatever_path(grid.param_name => grid.as_query) %>">Followed People</a>
Ellerden commented 4 years ago

Thanks! Works like a charm