How to filter list data from the URL?
Navigate your users to a filtered version of the list
This is a handy feature if you want your users to be taken to a filtered version of your List via URL. You can filter the list through an Inline Filter or Search. Let’s consider the Inline Filter case first.
Filtering the list through an inline filter
To filter the list by one of the Inline Filter values, you need to use the following format: ?filter-by-fieldName=fieldValue
You should add the filtering parameters at the end of your List URL, replacing fieldName with the name of the field you want to use for filtering and fieldValue with the value you want to filter by. Let's consider a specific example to make it clear.
Example
Let's say we have a list of employee profiles with a Position field and want to have a URL that filters the list, leaving only the profiles where the Position is Engineer.
First of all, let's set up a corresponding Inline Filter.
Next, let's configure the URL, which will look as follows:
- https://<subdomain>.softr.app/list?filter-by-Position=Engineer
That's it. Now, let's check if everything is working correctly.
Testing the filtering
Filtering the list through search
To pre-filter the list through search, you need to use the following format: ?search-for=searchValue
You should add the parameter at the end of your List URL, replacing searchValue with the query you want to filter the list by. Let's consider a specific example to make it clear.
Example
Let’s say we have a list of tasks for a software development team, where each task has a name.
So, if we add the following parameter at the end of our page URL, we will see a list that only contains entries with a value “merge”: ?search-for=merge
Combining search and inline filters
It’s also possible to combine inline filter and search parameter formats by simply joining them with an “&”: ?filter-by-fieldName=fieldValue&search-for=searchValue
As a result, only the list records that match both of the conditions will be displayed.
Last updated on March 21, 2024