DxReportDesignerCallbacks.PreviewCustomizeParameterLookUpSource Property
Specifies the JavaScript function that handles the Web Report Designer’s CustomizeParameterLookUpSource client-side event.
Namespace: DevExpress.Blazor.Reporting
Assembly: DevExpress.Blazor.Reporting.v25.2.JSBasedControls.Common.dll
NuGet Package: DevExpress.Blazor.Reporting.JSBasedControls.Common
Declaration
Property Value
| Type | Description |
|---|---|
| String | The name of a JavaScript function used to handle the |
Remarks
The PreviewCustomizeParameterLookUpSource event occurs each time a look-up editor is created for a report parameter.
The handler function receives two parameters: the first parameter is the client-side Report Designer (the event sender) and the second parameter is an object with the following properties:
parameter- An object that stores information about a parameter.
items- A collection of look-up parameter values.
dataSource- The data source that provides look-up values for the parameter editor.
The following example demonstrates how to sort look-up values of the categoryName parameter based on a custom rule. Declare an array that has category names in a sequence based on the required criterion. Then, check the parameter field of the object passed as the event’s second parameter to identify the required parameter. Access look-up values using the items field and sort them using a custom sorting function, which compares indexes of categories in the array. Finally, pass the result to the dataSource property to apply changes.
window.DesignerCustomization = {
onPreviewCustomizeParameterLookUpSource: function (s, e) {
var sortRule = ['Produce', 'Meat/Poultry', 'Dairy Products',
'Grains/Cereals', 'Seafood', 'Confections', 'Condiments', 'Beverages'];
if(e.parameter.name == 'categoryName') {
e.items.sort(function(a, b) {
if (sortRule.indexOf(a.value) > sortRule.indexOf(b.value)) {
return 1;
}
if (sortRule.indexOf(a.value) < sortRule.indexOf(b.value)) {
return -1;
}
return 0;
});
e.dataSource = new DevExpress.data.DataSource({ store: e.items});
}
}
}