Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the custom filter on certain links #317

Open
HansenAB opened this issue Jul 25, 2016 · 3 comments
Open

Use the custom filter on certain links #317

HansenAB opened this issue Jul 25, 2016 · 3 comments

Comments

@HansenAB
Copy link

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?

@leikind
Copy link
Owner

leikind commented Jul 25, 2016

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

@HansenAB
Copy link
Author

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

@leikind
Copy link
Owner

leikind commented Jul 26, 2016

probably a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants