Configuring a default view in grids via the v10 application database
According to your requirements, you might want to configure from the database a specific default view for a number of users when opening a data or a process grid (hidden columns, grouping or sorting applied, etc.).
In this article, understand the logic and configure a specific default view in a data grid via the back-end.
Understanding the Back-End Logic
When a grid default view is modified by applying filters, sorting, grouping or hidden columns, the k_user_grid and k_user_grid_field tables are automatically updated in the database. These two tables are responsible for keeping the latest user's configuration and are cleared when the view is reset to default. If you save a specific view in the Web App, the application creates a snapshot of the k_user_grid and k_user_grid_field tables and automatically inserts that view configuration into the k_user_grid_view and k_user_grid_field_view tables.
Therefore, to have the correct view opened by default without having users to reload the saved view, the last configuration of the k_user_grid and k_user_grid_field tables must be copied into the k_user_grid_view and k_user_grid_field_view tables and the is_selected parameter in the k_user_grid_view must be set to 1.
Configuration Example
As an example, we will take the following scenario: I would like to configure a default view with hidden columns when opening a data grid.
To configure a grid default view with hidden columns, proceed as follows:
- Open the relevant grid in the Web Application.
- In the "Column" drop-down located in the grid header, hide the columns using the toggle button.
- On the database side, copy the configuration of the k_user_grid and k_user_grid_field tables.
- Paste the content into the k_user_grid_view and k_user_grid_field_view tables.
- In the k_user_grid_view table, configure the view as default by setting the value 1 for the is_selected parameter.
- Enter a name for the view in the nameView field.
- Repeat the operation for all the required users.