Back to Devexpress

ASPxClientCustomizeParameterPropertiesEventArgs Class

xtrareports-js-aspxclientcustomizeparameterpropertieseventargs.md

latest7.4 KB
Original Source

ASPxClientCustomizeParameterPropertiesEventArgs Class

Supplies data for the CustomizeParameterProperties event.

Declaration

ts
declare class ASPxClientCustomizeParameterPropertiesEventArgs extends ASPxClientEventArgs

Inheritance

ASPxClientEventArgs ASPxClientCustomizeParameterPropertiesEventArgs

constructor(parameter, parameterPanelLayoutItem, editors, getEditor, editOptions)

Initializes a new instance of the ASPxClientCustomizeParameterPropertiesEventArgs class with specified settings.

Declaration

ts
constructor(
    parameter: DevExpress.Reporting.Viewer.Parameters.IParameterDescriptor,
    parameterPanelLayoutItem: any,
    editors: DevExpress.Analytics.Utils.ISerializationInfo,
    getEditor: any,
    editOptions: any
)

Parameters

NameTypeDescription
parameterIParameterDescriptor

An IParameterDescriptor object that stores information about a report parameter.

| | parameterPanelLayoutItem | any |

An object that stores information about parameter panel layout items.

| | editors | ISerializationInfo |

An array of ISerializationInfo objects that store information required to serialize a property editor.

| | getEditor | any |

A function that gets serialization information for a property editor by its property name or model name.

| | editOptions | any |

An object that contains options used to specify the editing settings of parameters, groups, and separators:

|

Properties

editOptions Property

An object that contains options used to specify the editing settings of parameters, groups, and separators.

Declaration

ts
editOptions: any

Property Value

Type
any

Remarks

The editOptions property contains the following option:

allowDeleteSpecifies whether users can delete an item. When set to false, hides the Delete button for the specified item.

Set the editOptions.allowDelete property to false to hide delete buttons for specified items.

The following snippet hides delete actions for all parameters in the Properties Panel, Field List, and Parameter Editor. Note that users can still remove parameter groups and separators:

js
function customizeParameterProperties(sender, args) {
    if (args.parameter) {
        args.editOptions.allowDelete = false;
    }    
}

editors Property

An array of objects that store information required to serialize a property editor.

Declaration

ts
editors: any

Property Value

TypeDescription
any

An array of ISerializationInfo objects that store information required to serialize a property editor.

|

Remarks

The following code snippet hides all property editors for the parameter1 parameter:

js
function customizeParameterProperties(sender, args) {
    if (args.parameter) {
      const name = args.parameter.name;
        if (name === 'parameter1'){
        args.editors.forEach(i => {
            // Hide editors.
            i.visible = false;
            // Disable editors.
            //i.disabled = true;
        });
    }    
}}

The parameter1 parameter has no visible property editors:

Parameter Editor: Properties Panel

getEditor Property

A function that gets serialization information for a property editor by its property name or model name.

Declaration

ts
getEditor: DevExpress.Analytics.Utils.ISerializationInfo

Property Value

TypeDescription
ISerializationInfo

An ISerializationInfo object that stores serialization information for a property editor.

|

Remarks

Use the getEditor function to get serialization information about the property editor by its name. The use of the function is necessary because the display names of the same editors may differ in the Properties Panel and Parameter Editor.

javascript
function customizeParameterProperties(sender, args) {
    if (args.parameter) {
        const allowNullInfo = args.getEditor('allowNull');
        if (allowNullInfo) {
            // Hide the Allow null value checkbox.
            allowNullInfo.visible = false;
        }
        const name = args.parameter.name;
        if (name === 'parameter3') {
            const descriptionEditor = args.getEditor('description');
            if (descriptionEditor) {
                // Disable the Description editor.
                descriptionEditor.disabled = true;
            }
        }
    }
    if (args.parameterPanelLayoutItem.layoutItemType === 'Group') {
        const titleEditor = args.getEditor('title')
        // Disable the Title editor.
        titleEditor.disabled = true;
    }    
}

The property editors for parameter3 look as follows (the Allow Null Value checkbox is hidden and the Description editor is disabled):

Parameter Panel Properties Panel

parameter Property

An object that stores information about a report parameter.

Declaration

ts
parameter: DevExpress.Reporting.Viewer.Parameters.IParameterDescriptor

Property Value

TypeDescription
IParameterDescriptor

An IParameterDescriptor object that stores information about a report parameter.

|

Remarks

The following snippet hides delete actions only for the parameter1 parameter in the Properties Panel, Field List, and Parameter Editor:

js
function customizeParameterProperties(sender, args) {
    if (args.parameter) {
        const name = args.parameter.name;
        if (name === 'parameter1') {
            args.editOptions.allowDelete = false;
        }
    }    
}

parameterPanelLayoutItem Property

An object that stores information about parameter panel layout items. This object contains the item name and its type (parameter/group/separator).

Declaration

ts
parameterPanelLayoutItem: any

Property Value

Type
any

Remarks

The following code snippet disables the Title editor for all parameter groups:

js
function customizeParameterProperties(sender, args) {
    if (args.parameterPanelLayoutItem.layoutItemType === 'Group') {
        const titleEditor = args.getEditor('title')
        // Disable the Title editor.
        titleEditor.disabled = true;
    }    
}