How do you handle sorting, swap, and filtering options?

This is a common thing: you have a list of items with several attributes. You can:

  • sort the list according to each attribute in ascending and descending order.
  • filter (search) elements, again by all attributes
  • navigate between different pages of results

All this gives you different options for this page:

  • sort attribute and sort order
  • pairs of attribute name and filtering values
  • page number

How do you handle the distribution of all these parameters between your pages? Say you can edit one item, and when you return, you want to get to the same page where you are.

You just put all the parameters in the url (and pass them as "return parameters" to the edit page)? Do you put some of them in a session (possibly sorting and filtering options)?

+3
source share
1 answer

I like to make them part of the URL, so if someone sees the page or writes a link to the page, it will make the page exactly the same. You cannot do this if you are dependent on the state of the session.

0
source

Source: https://habr.com/ru/post/1780456/


All Articles