wice_grid
wice_grid copied to clipboard
Use the custom filter on certain links
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?
look at the source of _grid.html.erb
on this page http://wicegrid.herokuapp.com/custom_filter_params
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
probably a bug.