Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a68e70d

Browse filesBrowse files
Update how-to-create-a-custom-parameter-editor.md
1 parent 9128907 commit a68e70d
Copy full SHA for a68e70d

File tree

1 file changed

+9
-73
lines changed
Filter options

1 file changed

+9
-73
lines changed

‎embedding-reports/display-reports-in-applications/web-application/html5-report-viewer/customizing/how-to-create-a-custom-parameter-editor.md

Copy file name to clipboardExpand all lines: embedding-reports/display-reports-in-applications/web-application/html5-report-viewer/customizing/how-to-create-a-custom-parameter-editor.md
+9-73Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Custom Parameter Editors
33
page_title: Creating and Using Custom Parameter Editors in HTML5 ReportViewer
4-
description: "Learn How to Create and use Custom Parameter Editors in the HTML5 ReportViewer in Telerik Reporting."
4+
description: "Learn how to create and use Custom Parameter Editors in the HTML5 ReportViewer in Telerik Reporting."
55
slug: telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/customizing/how-to-create-a-custom-parameter-editor
6-
tags: how,create,custom,parameter,editor
6+
tags: create,custom,parameter,editor
77
published: True
88
position: 3
99
previous_url: /html5-report-viewer-howto-custom-parameter-editor
@@ -13,85 +13,21 @@ previous_url: /html5-report-viewer-howto-custom-parameter-editor
1313

1414
The article elaborates on how to change the default editors for visible parameters in the HTML5 Viewer's Parameters Area.
1515

16-
Custom parameter editors are defined through the parameterEditors ([Report Viewer Initialization]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/api-reference/report-viewer-initialization%})) array passed as an option when creating the report viewer widget. Each object represents a parameter editor factory for creating editors suitable to edit a specific report parameter configuration.
16+
Custom parameter editors are defined through the parameterEditors ([Report Viewer Initialization]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/api-reference/report-viewer-initialization%})) array passed as an option when creating the report viewer widget. Each object represents a parameter editor factory for creating editors suitable for editing a specific report parameter configuration.
1717

18-
Each editor is an object which contains two methods: `match` and `createEditor`.
18+
Each editor is an object that contains two methods: `match` and `createEditor`.
1919

20-
The `match` method accepts a report parameter to be edited as an argument and returns a boolean value which indicates whether the parameter editor is suitable for this parameter. The parameter variable exposes the properties of the report parameter like name, allowNull, availableValues, multiValue, type, etc.
20+
The `match` method accepts a report parameter to be edited as an argument and returns a boolean value that indicates whether the parameter editor is suitable for this parameter. The parameter variable exposes the properties of the report parameter, like _name_, _allowNull_, _availableValues_, _multiValue_, _type_, etc.
2121

22-
The main work for creating and utilizing the parameter editor is done in the `createEditor` method. Its purpose is to create the parameter editor UI and wire it to the `parameterChanged` callback when a new value is selected. The return result is a new object containing the `beginEdit` method which is the entry point for creating the editor from the viewer.
22+
The main work for creating and utilizing the parameter editor is done in the `createEditor` method. Its purpose is to create the parameter editor UI and wire it to the `parameterChanged` callback when a new value is selected. The return result is a new object containing the `beginEdit` method, which is the entry point for creating the editor from the viewer.
2323

24-
The following example illustrates how to use the Kendo DropDownList widget for a single parameter value parameter editor which also has available values:
24+
The following example illustrates how to use the Kendo DropDownList widget for a single parameter value parameter editor, which also has available values:
2525

26-
````JavaScript
27-
{
28-
match: function (parameter) {
29-
// Here you can use all of the parameter properties to
30-
// create a more specific editor
31-
return Boolean(parameter.availableValues) && !parameter.multivalue;
32-
},
33-
createEditor: function (placeholder, options) {
34-
var dropDownElement = $(placeholder).html('<div></div>');
35-
var parameter,
36-
valueChangedCallback = options.parameterChanged,
37-
dropDownList;
38-
function onChange() {
39-
var val = dropDownList.value();
40-
valueChangedCallback(parameter, val);
41-
}
42-
return {
43-
beginEdit: function (param) {
44-
parameter = param;
45-
$(dropDownElement).kendoDropDownList({
46-
dataTextField: "name",
47-
dataValueField: "value",
48-
value: parameter.value,
49-
dataSource: parameter.availableValues,
50-
change: onChange
51-
});
52-
dropDownList = $(dropDownElement).data("kendoDropDownList");
53-
}
54-
};
55-
}
56-
}
57-
````
26+
{{source=CodeSnippets\BlazorAppSnippets\wwwroot\customize\SingleParameterEditor.js}}
5827

5928
Passing the parameter editor to the viewer:
6029

61-
````JavaScript
62-
<script type="text/javascript">
63-
$("#reportViewer1").telerik_ReportViewer({
64-
parameterEditors: [{
65-
match: function (parameter) {
66-
return Boolean(parameter.availableValues) && !parameter.multivalue;
67-
},
68-
createEditor: function (placeholder, options) {
69-
var dropDownElement = $(placeholder).html('<div></div>'),
70-
parameter,
71-
valueChangedCallback = options.parameterChanged,
72-
dropDownList;
73-
function onChange() {
74-
var val = dropDownList.value();
75-
valueChangedCallback(parameter, val);
76-
}
77-
return {
78-
beginEdit: function (param) {
79-
parameter = param;
80-
$(dropDownElement).kendoDropDownList({
81-
dataTextField: "name",
82-
dataValueField: "value",
83-
value: parameter.value,
84-
dataSource: parameter.availableValues,
85-
change: onChange
86-
});
87-
dropDownList = $(dropDownElement).data("kendoDropDownList");
88-
}
89-
};
90-
}
91-
}]
92-
});
93-
</script>
94-
````
30+
{{source=CodeSnippets\BlazorAppSnippets\wwwroot\customize\PassingParameterEditorToViewer.html}}
9531

9632
>tip You can use any other custom UI covering the requirements of the `createEditor` method.
9733

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.