This example shows how to filter data in Designer mode. In this mode, the control displays only several records at a time from the datasource to improve performance.
On the client, the DashboardControlOptions.onOptionChanged event is handled to catch the moment when the working mode is changed. The current mode is passed to the server through the FetchRemoteService.headers dictionary. After that, the DashboardControl.reloadData method call initiates a data reloding callback (See also: Manage an In-Memory Data Cache).
On the server, the IHttpContextAccessor with dependency injection is used to access the passed working mode in code (HttpContext.Request.Headers["DashboardWorkingMode"]
).
This example filters data in the following data sources:
-
The DashboardConfigurator.DataLoading event is handled to filter data for this data source.
-
DashboardSqlDataSource with the regular SelectQuery
The DashboardConfigurator.CustomFilterExpression event is handled to filter data for this data source.
-
DashboardSqlDataSource with the custom SQL query - CustomSqlQuery
A custom SQL query contains the
queryParamTopID
parameter mapped to the Dashboard Parameter (see Pass Parameter Values and Pass Query Parameters). The dashboard parameter and its values are generated dynamically in the DashboardConfigurator.CustomParameters event handler.