wice_grid icon indicating copy to clipboard operation
wice_grid copied to clipboard

Use the custom filter on certain links

Open HansenAB opened this issue 8 years ago • 3 comments

Hi, What I am trying to do is when a user click a specific link, it should redirect this user to the grid with the custom filter condition. For instance I have a custom filter "fee paid", it has two options "paid" and "not paid" g.column name: 'Payment', attribute: 'closed', assoc: [:order_item, :order], custom_filter: {'Paid' => 1, 'Unpaid' => 0} do |app|

I want that so when a user click a link on other page, it redirect to this page only showing the paid record. It is kind of like combine the two steps(load the page and use the filter) into one step. How should I do it?

HansenAB avatar Jul 25 '16 15:07 HansenAB

look at the source of _grid.html.erb on this page http://wicegrid.herokuapp.com/custom_filter_params

leikind avatar Jul 25 '16 15:07 leikind

Thank you, it helps, but still there is a problem. I think it is caused by ordering or association, I am not sure.

The link generated by clicking the filter is: applications?grid%5Bf%5D%5Borders.closed%5D%5B%5D=1 But the link generated by the helped is: applications?grid%5Bf%5D%5Bclosed%5D%5B%5D=1 The part orders is missing

Here is the controller: included=[:user, order_item: {order: :payments}}]

@applications_grid = initialize_grid(
    applications,
    include: included,
    order: 'applications.updated_at',
    order_direction: 'asc',
    per_page: 50
)`

I am not sure what is happening here

HansenAB avatar Jul 26 '16 14:07 HansenAB

probably a bug.

leikind avatar Jul 26 '16 14:07 leikind