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

Bug: Filter parameters are not applied after switching to another view #582

Open
evgenybf opened this issue Sep 29, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@evgenybf
Copy link

evgenybf commented Sep 29, 2024

Describe the bug
After returning to a page with configured Filter parameters, records are not filtered until the parameters are changed again.

To Reproduce

  1. Go to the demo site, to the "Blog Posts" view: https://starlette-admin-demo.jowilf.com/admin/sqla/post/list

  2. Select Filter, "Title, Contains, test"
    image
    Result: Filter is applied, records are filtered. - correct.

  3. Go to another view, e.g. "Comments", get back to "Blog Posts".
    Result: Filter is set, but records are not filtered - wrong.
    image

Environment (please complete the following information):

  • starlette_admin~=0.14.1
  • ORM/ODMs: [SQLAlchemy, MongoEngine]
    also can be reproduced on the official demo site.
@evgenybf evgenybf added the bug Something isn't working label Sep 29, 2024
@evgenybf
Copy link
Author

(it's a different bug, but has some similarities)

Field search filter behaves weirdly:

  1. when model.save_state=True
    Add search value, refresh the page - search string keeps the search value, filter is applied - OK
    Revisit the page. Search value is empty, filter is still applied. - wrong
    image

  2. when model.save_state=False
    Add search value, refresh the page - search string keeps the search value, filter is not applied. - OK?
    Revisit the page. Search value is empty, filter is not applied. - OK

@jowilf
Copy link
Owner

jowilf commented Sep 30, 2024

I think we need a deep work on the state management and consider saving the state in the URL. All of this is possible with DataTables

when model.save_state=False
Add search value, refresh the page - search string keeps the search value, filter is not applied. - OK?
Revisit the page. Search value is empty, filter is not applied. - OK

By default datatables keep the state for 2hour https://datatables.net/examples/basic_init/state_save.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants