vcl-dxdashboard-dot-control-dot-tdxcustomdashboardcontrol-2f1c0fbf.md
Provides access to the dashboard/user interaction state (in JSON).
property State: TStringList read;
| Type | Description |
|---|---|
| TStringList |
Stores a dashboard state (as JSON strings).
|
The State property provides access to the dashboard/user interaction state that includes filter criteria, drill-down values, the active tab page, dashboard parameter values, individual data visualization item states, and other configuration options set by users (in the modal Dashboard Viewer dialog or dashboard control UI).
Use the State property to load, save, and access the dashboard state (in the JSON format). Every State property value change raises the OnStateChanged event, which you can handle to save dashboard state changes to a file or stream as demonstrated in the following code example: Save Dashboard State to File in Response to User Changes.
The State property value stores parameter values. Every parameter value or setting change updates the State property value and redraws dashboard content. Enclose multiple parameter changes between Parameters.BeginUpdate and Parameters.EndUpdate procedure calls to avoid excessive state updates and improve performance.
Call State.LoadFromFile/State.LoadFromStream and State.SaveToFile/State.SaveToStream procedures to import and export dashboard states in the JSON format.
In addition, you can use State.Strings and State.Text properties to access and modify dashboard states directly (if required).
Refer to the TStringList class description for detailed information on all available options.
The following code example saves the current dashboard user interaction state to a JSON file on every change:
uses
dxDashboard.Control; // Declares the TdxDashboardControl component
// ...
procedure TMyForm.dxDashboardControl1StateChanged(ASender: TdxCustomDashboardControl);
begin
ASender.State.SaveToFile(ASender.DashboardName + 'State.json');
end;
#include "dxDashboard.Control.hpp" // Declares the TdxDashboardControl component
// Add the following linker directive to the corresponding CPP source file:
#pragma link "dxDashboard.Control" // Required to use dxDashboard.Control.hpp declarations
// ...
void __fastcall TMyForm::dxDashboardControl1StateChanged(TdxCustomDashboardControl *ASender)
{
ASender->State->SaveToFile(ASender->DashboardName + "State.json");
}
See Also
TdxCustomDashboardControl.Layout Property
TdxCustomDashboardControl Class