leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
536 stars 215 forks source link

Saving other http query parameters along with filters #328

Open kingsdeb opened 7 years ago

kingsdeb commented 7 years ago

I am currently customizing the column display by passing some query parameters in the get request. By that i am setting conditions in the grid to display column or not.

For e.g:

if @value
 g.column name: 'Name', attribute: 'name' ...
end

If value is set, will display the column. I have many columns and i don't want to hide the columns using CSS, i just want to get the columns which are desired in every request. I even dump the filter in the request as hidden fields. This is working as well. Note sure if this is the correct way to do it.

But i now want to save my other http query parameters along with the filters in the serialised query which gets created. Can we do it ?

leikind commented 7 years ago

This is perfectly valid way to show/hide certain columns, but I am afraid you will have to store @value separately

kingsdeb commented 7 years ago

When you say "store the @value separately" , does it mean, we will have create new attributes in saved query model and pass the value using "extra_parameters" hash ?

leikind commented 7 years ago

I am not sure, I mean you will have to find a way to deal with it outside of the plugin, in your app. If I were you I would copy the code for saved queries from the plugin to your app and modify it to your liking. I've wanted to remove this functionality away from the plugin many times, I believe it doesn't belong there,].

kingsdeb commented 7 years ago

Okay, Thanks for the quick reply. @leikind