This topic is under construction for the 17.3 release of LabKey Server. For current documentation of this feature, click here.
When you are looking at a data grid, you can sort
the data as you wish, but those sorts and filters only persist for your current session on that page. Using the .lastFilter parameter
on the URL can preserve the last filter, but otherwise these sorts and filters are temporary.
To create a persistent filter or sort, you can save it as part of a custom grid view. If this saved grid view is shared with all users, the saved filters and sorts defined on it are also available to those users.
Define a Saved Sort
- Navigate to the grid you'd like to modify.
- Select (Grid Views) > Customize Grid
- Click the Sort tab.
- In the left panel, click the checkbox(es) for fields on which you want to sort.
- In the right panel, specify whether the sort order should be ascending or descending for each sort applied.
- Click Save.
- You may save as a new named grid view or as the default and select whether to make it available to all users.
You can also create a saved sort by first sorting your grid directly using the column headers, then opening the grid customizer panel to convert the local sort to a saved one.
- In the grid view with the saved sort applied above, sort on a second column, in this example we chose 'Lymphs'.
- Open (Grid Views) > Customize Grid.
- Click the Sort tab. Note that it shows (2), meaning two sorts are now defined. Until you save the grid view with this additional sort included, it will remain as temporary as sorts usually are.
- Drag and drop if you want to change the order in which sorts are applied.
- Remember to Save your grid to save the additional sort.
Define a Saved Filter
The process for defining saved filters is very similar. You can filter locally first or directly define saved filters. An important advantage of using the saved filters interface is that when filtering locally, you are limited to two filters on a given column. Saved filters may include any number of separate filtering expressions for a given column, which are all ANDed together.
- Select (Grid Views) > Customize Grid.
- Click the Filter tab.
- In the left panel, check boxes for the column(s) on which you want to filter.
- Drag and drop filters in the right panel to change the filtering order.
- In the right panel, specify filtering expressions for each selected column. Use pulldowns and value entry fields to set expressions, add more using the (Add) buttons.
- Use the buttons to delete individual filtering expressions.
- Save the grid; select whether to make it available to other users.
Apply Grid Filter
When viewing a data grid, you can enable and disable all saved filters and sorts
using the Apply Grid Filter
checkbox in the (Grid Views)
menu. All defined filters and sorts are applied at once using this checkbox - you cannot pick and choose which to apply. If this menu option is not available, no saved filters or sorts have been defined.
Interactions Among Filters and Sorts
Users can still perform their own sorting and filtering as usual when looking at a grid that already has a saved sort or filter applied.
- Sorting: Sorting a grid view while you are looking at it overrides any saved sort order. In other words, the saved sort can control how the data is first presented to the user, but the user can re-sort any way they wish.
- Filtering: Filtering a grid view which has one or more saved filters results in combining the sets of filters with an AND. That is, new local filters happen on the already-filtered data. This can result in unexpected results for the user in cases where the saved filter(s) exclude data that they are expecting to see. Note that these saved filters are not listed in the filters bar above the data grid, but they can all be disabled by unchecking the Grid Views > Apply View Filter checkbox.