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

List view customization, maintain state. #1535

Closed
luislaborda opened this issue Mar 8, 2017 · 2 comments
Closed

List view customization, maintain state. #1535

luislaborda opened this issue Mar 8, 2017 · 2 comments

Comments

@luislaborda
Copy link

luislaborda commented Mar 8, 2017

In the list view and within the layout.html.twig, I'm adding a checkbox that shows/hide rows based on a status. The issue arise when editing or creating a new record, regardless of what I do in the listAction or in createListQueryBuilder the referer removes any additional parameter that I pass, loosing state for the list view. Is there a way to solve this problem?

Is there a feature we can add to the bundle to maintain state?

Thanks

L.

@rimi-itk
Copy link
Contributor

We've had the use for this as well. Our current (quick and (maybe) dirty) solution goes like this:

  1. Add "params" to your Easy Admin entity configuration, e.g.

    easy_admin:
        …
        entities:
            Event:
                …
                list:
                    …
                    params:
                        # name: default value
                        _event_list_filter: my
                    …
        …
    

    (cf. https://github.com/itk-event-database/event-database-api/blob/dfad5bb838c5223b6e8a5667f8668488f1a7283c/app/config/easyadmin.yml#L73-L75)

  2. Add a POST_INITIALIZE event to add the specified parameters to the request if they're not already set: https://github.com/itk-event-database/event-database-api/blob/develop/src/AdminBundle/EventSubscriber/EasyAdminSubscriber.php#L33-L46

Note: This is our first stab at this and there may be – and probably are – better ways to do this. Fell free to use or comment on our current solution.

Best regards,
Mikkel

@javiereguiluz
Copy link
Collaborator

I'm closing this issue because we're starting a new phase in the history of this bundle (see #2059). We've moved it into a new GitHub organization and we need to start from scratch: no past issues, no pending pull requests, etc.

I understand if you are angry or disappointed by this, but we really need to "reset" everything in order to reignite the development of this bundle.

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

3 participants