WebDocumentViewerClientSideEventsBuilder.ParametersSubmitted(String) Method
Specifies the JavaScript function that handles the client-side ParametersSubmitted event.
Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer
Assembly: DevExpress.AspNetCore.Reporting.v24.2.dll
NuGet Package: DevExpress.AspNetCore.Reporting
Declaration
Parameters
Name | Type | Description |
---|---|---|
callback | String | The name of a JavaScript function or entire JavaScript function code that runs when the ParametersReset event is fired. |
Returns
Type | Description |
---|---|
WebDocumentViewerClientSideEventsBuilder | A WebDocumentViewerClientSideEventsBuilder object that can be used for method chaining. |
Remarks
The ParametersSubmitted event is raised when the user enters parameter values and clicks the Submit button in the Preview Parameters panel.
You can handle this event to change parameter values passed to the server because Parameter Model values remain unchanged and do not cause errors on the client side.
Examples
The following code snippet changes the parameter value sent to the server and collapses the Parameters panel when a user clicks the Submit button:
<script type="text/javascript" id="script">
function onParametersSubmitted(s, e) {
e.Parameters.filter(function (p) { return p.Key == "YourParameterNameHere"; })[0].Value = "SomeValue";
var preview = s.GetPreviewModel();
if (preview) {
preview.tabPanel.collapsed = true;
}
}
</script>
@{
var viewerRender = Html.DevExpress().WebDocumentViewer("DocumentViewer")
.Height("1000px")
.ClientSideEvents(configure => configure.ParametersSubmitted("onParametersSubmitted"))
.Bind("TestReport");
@viewerRender.RenderHtml()
}
The following code passes a custom object as a report parameter (MyComplexParameter) to the server. A custom object in this code snippet contains data selected in a custom editor (MyComplexEditor) specified in the CustomizeParameterEditors event:
<script type="text/javascript" id="script">
function onParametersSubmitted(s, e) {
e.Parameters.filter(item => item.Key === "MyComplexParameter")[0].Value = JSON.stringify(myComplexEditorModel.value())
}
</script>
@{
var viewerRender = Html.DevExpress().WebDocumentViewer("DocumentViewer")
.Height("1000px")
.ClientSideEvents(configure => configure.ParametersSubmitted("onParametersSubmitted"))
.Bind("TestReport");
@viewerRender.RenderHtml()
}