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

filters - the list should remain filtered if we access the same ui-state in different ways #685

Closed
githubGabriela opened this issue Sep 10, 2015 · 10 comments
Labels

Comments

@githubGabriela
Copy link

Hello guys :) Very good work with ng-admin, congrats!!!!!

I have a little bug with the filters..
So, my application has a dashboard with a list of Clients, and a menu with clients and other entities. From the dashboard I can go to the page /clients/list where I list the clients with some information.
I also added some filters on name, status and address.
To see the list of clients I can also click on the menu Clients that correspond to the same url: /clients/list
(I want to specify that these are views generated by ng-admin, none of them is custom)

So, this is the workflow:
From the dahsboard, I click on the link 'My Clients' and I am redirected to /clients/list. Then I filter by name, I put the value 'john' in the textbox filter.
My table is filtered correctly, so everything is OK till now.
Then I click on the menu item 'My Clients' and I am redirected to the same url /clients/list, with the value of the filter 'john' (the value remains typed in).
The problem is that the list of clients is not filtered anymore because the _filter query is made only when we type something in the filter box.

Actually the filter should have a watch.. if there is something already typed in the filter then it should list the clients filtered.

Thank you!
Gabriela

@fzaninotto
Copy link
Member

Hi Gabriela,

And thanks for the compliment.

filters are already persistent when you navigate within an entity, i.e. if you go from the filtered list of clients to a client detail, and then back to the list (using the list button or the browser's back button), the filters are kept (since #418).

Also, the filters do have a watch if you change the URL, the filters update.

The only think that doesn't work in what you ask for is that filters aren't kept when going back to the list using the sidebar menu. And I'm not sure if we want to keep filters on in this case, because I find it convenient to be able to reset filters by clicking on the sidebar menu.

I wonder what other users think about it?

@marknelissen
Copy link

Hi,

I'm a colleague of githubGabriela working on the same project. The main issue with the filter reset when clicking on the navigational menu on the left, is that the although the list is no longer filtered, the value remains in the filter input field. This prevents (due to lazy binding) to apply the same value to the filter. To explain with the example of githubGabriela:

  • go to dashboard
  • click on dashboard pane title link to go to clients list
  • list is shown unfiltered
  • add value to filter (eg. name = John)
  • list is filtered
  • click on menu item to go to client list
  • list is shown, no longer filtered, but name filter input still contains the value "John"

On top of the fact that this prevents searching again on John, without first entering a new value, this is also not consistent. The filter display indicates the presence of a filter that is not applied to the list. This behaviour was observed on version 0.8.0.

On top of this, it would be nice to have an option when defining the filters to give them a default value. The use case we have, is that the default view of the list should be to only show the clients of the current user, but with an option to deactivate this filter to view all clients. Currently this is not possible, since the permanent filter cannot be interacted with by the user, and we cannot set a default value in a regular filter, that is applied on first/initial visit to the page.

@fzaninotto
Copy link
Member

Hi Mark,

I can't reproduce the issue in ng-admin-demo (http://marmelab.com/ng-admin-demo/).

  1. I click on "catalog/posters" in the sidebar
  2. I add a "Category" filter on "transport"
  3. the list is filtered
  4. I click again on "catalog/posters" in the sidebar
  5. the filters are emptied
  6. the list isn't filtered anymore.

Are you using the latest ng-admin version?

@marknelissen
Copy link

Actually, the situation seems worse on the demo. I executed the following steps on the demo:

  • go to dashboard
  • click Pending orders
  • add filter on status
  • select value (eg. delivered)
    • the filter is not applied
  • click on Orders in menu bar
    • the status field remains present and filled with the previous value (delivered) but the list is filtered on status = ordered (something that was never requested)

The problem only exists if the first visit is through the link on the dashboard pane. When going to the view through the menu bar, everything works as described: when clicking again on the menu bar, the filter is reset.

My guess is that it is somehow related to the search=null query parameter added to the url when going to the list coming from the dashboard. This must somehow mess with the scopes/states of the application.

We are using the latest released version of ngadmin (0.8.0), which in regards to the multiple commits, is no longer the most up to date. :) On which version is the demo running?

@marknelissen
Copy link

BTW, nice login page. Is this now also a feature of ng-admin (or upcoming) or has it been implemented especially for the demo site?

@marknelissen
Copy link

I've split off the request for the default value feature into a separate issue (#690)

@fzaninotto
Copy link
Member

The "orders" page is in fact a list of "commands" with a preset filter of "status=ordered". If you click on "pending orders" from the homepage, you should also arrive to a prefiltered list.

In other terms, what you see in the ng-admin demo is normal.

You should use the (yet unreleased) 0.9.0-dev, i.e. the github master HEAD.

As for the login, it's a very simple (and insecure) login page. Look at the source to see how it works.

@marknelissen
Copy link

I understand, but this means there is a bug with this, since when coming from the dashboard, the list is not filtered on status.

@fzaninotto
Copy link
Member

We don't understand each other. I suggest you come to chat on ng-admin's gitter channel to make things clearer for me.

@fzaninotto
Copy link
Member

OK, after chatting with @marknelissen, the bug is confirmed. Reproduction is simple:

  1. go to dashboard
  2. click on the title of the first dashboard panel listing orders
  3. you arrive to a non-filtered list of orders
  4. Add a "status" filter and set it to anything
  5. the list isn't filtered

Adding the "bug" label.

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

No branches or pull requests

3 participants