Back to Devexpress

DashboardParameter Interface

dashboard-js-devexpress-dot-dashboard-6e958432.md

latest9.5 KB
Original Source

DashboardParameter Interface

A dashboard parameter.

Declaration

ts
export interface DashboardParameter

Methods

getDefaultValue Method

Returns a default parameter value.

Declaration

ts
getDefaultValue(): DevExpress.Dashboard.Data.PrimitiveType | Array<DevExpress.Dashboard.Data.PrimitiveType>

Returns

TypeDescription
PrimitiveType

A PrimitiveType object that is a default parameter value.

| | PrimitiveType[] |

An array of the PrimitiveType objects that are default parameter values.

|

Example

This example shows how to change dashboard parameter values on the client.

The example uses the following methods:

DashboardParameterDialogExtension.getParametersReturns dashboard parameter settings and metadata.DashboardParameter.setValueSpecifies the current parameter value(s).DashboardParameter.getDefaultValueReturns a default parameter value.DashboardParameterDialogExtension.showInvokes the Dashboard Parameters dialog.

View Example

js
function onBeforeRender(s) {
    var dashboardControl = s.GetDashboardControl();
    if (dashboardControl) {
        dashboardControl.on('dashboardEndUpdate', function () { setParameterValues(dashboardControl); })
    }
}

function setParameterValues(control) {
    var parameterDialogExt = control.findExtension('dashboardParameterDialog');
    $("#setParameterValuesButton").dxButton({
        text: 'Specify Parameter Values',
        onClick: function () {
            var parameters = parameterDialogExt.getParameters();
            var paramCategory = parameters.getParameterByName("categoryParameter"),
                paramStartDate = parameters.getParameterByName("startDateParameter");
            paramCategory.setValue("Condiments");
            paramStartDate.setValue(new Date(2015, 3, 1));
        }
    });
    $("#resetParameterValuesButton").dxButton({
        text: 'Reset Parameter Values',
        onClick: function () {
            var parameters = parameterDialogExt.getParameters();
            var paramCategory = parameters.getParameterByName("categoryParameter"),
                paramStartDate = parameters.getParameterByName("startDateParameter");
            paramCategory.setValue(paramCategory.getDefaultValue());
            paramStartDate.setValue(paramStartDate.getDefaultValue());
        }
    });
    $("#showParametersDialog").dxButton({
        text: 'Show Parameters Dialog',
        onClick: function () {
            parameterDialogExt.show();
        }
    });
}

See Also

Specify Dashboard Parameter Values

getDescription Method

Returns the parameter’s description displayed to an end user.

Declaration

ts
getDescription(): string

Returns

TypeDescription
string

A string that is the parameter’s description displayed to an end user.

|

getLookUpValues Method

Gets values for static and dynamic lists.

Declaration

ts
getLookUpValues(): Array<DashboardParameterLookUpValue>

Returns

TypeDescription
DashboardParameterLookUpValue[]

An array of DashboardParameterLookUpValue objects that is a collection of default parameter values.

|

See Also

Create a Dashboard Parameter in the WinForms Designer

getName Method

Returns a parameter name.

Declaration

ts
getName(): string

Returns

TypeDescription
string

A string that is the parameter name.

|

getType Method

Returns a parameter type.

Declaration

ts
getType(): string

Returns

TypeDescription
string

A string that identifies the type of dashboard parameter value.

|

getValue Method

Returns the current parameter value(s).

Declaration

ts
getValue(): DevExpress.Dashboard.Data.PrimitiveType | Array<DevExpress.Dashboard.Data.PrimitiveType>

Returns

TypeDescription
PrimitiveType

A PrimitiveType object that is the currently selected parameter value.

| | PrimitiveType[] |

An array of the PrimitiveType objects that are currently selected parameter values.’

|

See Also

Specify Dashboard Parameter Values

setValue(value) Method

Specifies the current parameter value(s).

Declaration

ts
setValue(
    value: DevExpress.Dashboard.Data.PrimitiveType | Array<DevExpress.Dashboard.Data.PrimitiveType>
): any

Parameters

NameTypeDescription
valuePrimitiveTypePrimitiveType[]

A PrimitiveType object that is the current parameter value(s).

|

Returns

TypeDescription
any

The current parameter value(s).

|

Example

This example shows how to change dashboard parameter values on the client.

The example uses the following methods:

DashboardParameterDialogExtension.getParametersReturns dashboard parameter settings and metadata.DashboardParameter.setValueSpecifies the current parameter value(s).DashboardParameter.getDefaultValueReturns a default parameter value.DashboardParameterDialogExtension.showInvokes the Dashboard Parameters dialog.

View Example

js
function onBeforeRender(s) {
    var dashboardControl = s.GetDashboardControl();
    if (dashboardControl) {
        dashboardControl.on('dashboardEndUpdate', function () { setParameterValues(dashboardControl); })
    }
}

function setParameterValues(control) {
    var parameterDialogExt = control.findExtension('dashboardParameterDialog');
    $("#setParameterValuesButton").dxButton({
        text: 'Specify Parameter Values',
        onClick: function () {
            var parameters = parameterDialogExt.getParameters();
            var paramCategory = parameters.getParameterByName("categoryParameter"),
                paramStartDate = parameters.getParameterByName("startDateParameter");
            paramCategory.setValue("Condiments");
            paramStartDate.setValue(new Date(2015, 3, 1));
        }
    });
    $("#resetParameterValuesButton").dxButton({
        text: 'Reset Parameter Values',
        onClick: function () {
            var parameters = parameterDialogExt.getParameters();
            var paramCategory = parameters.getParameterByName("categoryParameter"),
                paramStartDate = parameters.getParameterByName("startDateParameter");
            paramCategory.setValue(paramCategory.getDefaultValue());
            paramStartDate.setValue(paramStartDate.getDefaultValue());
        }
    });
    $("#showParametersDialog").dxButton({
        text: 'Show Parameters Dialog',
        onClick: function () {
            parameterDialogExt.show();
        }
    });
}

See Also

Specify Dashboard Parameter Values