This action event disables all parameters except the first on the initial load of the prompt screen. A parameter becomes enabled once the previous one in the list has been given a value. This could be used to enforce dependencies for parameter options.
Note: In this example, the client-side javascript is in separate file to improve readability.
Global Event Type: OnChangeParameterValue
This event occurs whenever the value of a parameter is changed in the prompt screen.
References:
- WebReportsApi.dll
Namespaces:
- WebReports.Api
Code
string actionString = File.ReadAllText(@"{filepath}\actionString.js");
sessionInfo.JavascriptAction.SetJsCode(actionString);
return sessionInfo.JavascriptAction;
actionString.js
var parameterList = clientInfo.parameterListCtrl.ParameterList;
var selectedIndex = clientInfo.parameterListCtrl.SelectedIndex;
var disableIndex = selectedIndex + 2; // disable everything beyond the next parameter
for (var i = 0; i < parameterList.length; i++)
{
if (i < disableIndex)
parameterList[i].SetEnabled(true);
else
parameterList[i].SetEnabled(false);
}