I’m using Stimulsoft Reports.JS in a React project.
In my report, I have a parameter with type is List String (variable) called MyParam. I want this parameter to be shown in the viewer toolbar as a dropdown, and the list of string options should be provided dynamically from my React code (e.g., from an API).
How to set list of string options for a parameter in Stimulsoft JS (React)?
-
- Posts: 7354
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to set list of string options for a parameter in Stimulsoft JS (React)?
Hello,
You can use the following code:
Thank you.
You can use the following code:
Code: Select all
var newVariable = new Stimulsoft.Report.Dictionary.StiVariable();
newVariable.name = "Variable";
newVariable.alias = "Variable";
newVariable.type = Stimulsoft.System.StimulsoftStringList;
newVariable.requestFromUser = true;
var di = new Stimulsoft.Report.Dictionary.StiDialogInfo();
di.allowUserValues = false;
di.keys = ["1", "2", "3", "4"];
di.values = ["1", "2", "3", "4"];
newVariable.dialogInfo = di;
report.dictionary.variables.add(newVariable);