We have already seen how you can introduce filters to list views in the Joomla admin & collate them under the Search tools menu previously in our Blog last year.
The Search tools filters are extremely useful to admins especially if your extension manages a lot of data. As a usability feature, Joomla retains the state of the filters to the ones last used by the user.
In most cases, manually setting the filters will work just great for Admins. However there are some cases when knowing how to set filter parameters via the URL can be very useful.
This can happen when you have lots of data in the system and by mistake the admin sets the filter to show all records. This leads to the page timing out and failing and giving you a white page of death. There is no way to manually set the filter in this case since Joomla remembers your last setting and you cant get the page back up to do it manually. In this case passing the count filter value can save you having to logout and restart a new session.
This can be useful for both Admins to bookmark as well as developers to create quick access links. With this you can create multiple configurations of preset filters and save the urls for them. These can be used by developers to give pre configured filter configurations to their users.
If the default url for your component lis view is index.php?option=component_name&view=countries
You can append filters as below.
Here, the name of the filter is filter[state]. We need to pass this name along with the value of the filter. This will set the filter named as filter[‘state’] to value 0 overriding the previous user state. You can add additional filter values by appending the additional filters with an ampersand.
Found the blog useful ? Do share it with your Joomla friends !