The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientDashboardItemUnderlyingData Class

Represents a list of records from the dashboard data source.

Declaration

declare class ASPxClientDashboardItemUnderlyingData

Remarks

An ASPxClientDashboardItemUnderlyingData object is returned by the ASPxClientDashboard.RequestUnderlyingData method.

You can also obtain the underlying data for specific visual elements when handling client-side events, for instance, the ASPxClientDashboard.ItemClick event. Use the ASPxClientDashboardItemClickEventArgs.RequestUnderlyingData method to do this.

Examples

The following example demonstrates how to get underlying data corresponding to a particular visual element using the ASPxClientDashboard's API.

In this example, the ASPxClientDashboard.ItemClick event is handled to obtain underlying data and invoke the dxPopup widget with the child dxDataGrid. In the event handler, the ASPxClientDashboardItemClickEventArgs.RequestUnderlyingData method is called to obtain records from the dashboard's data source. The dxDataGrid is used to display these records.

function getUnderlyingData(args) {
    var underlyingData = [];

    args.RequestUnderlyingData(function (data) {
        dataMembers = data.GetDataMembers();
        for (var i = 0; i < data.GetRowCount() ; i++) {
            var dataTableRow = {};
            $.each(dataMembers, function (_, dataMember) {
                dataTableRow[dataMember] = data.GetRowValue(i, dataMember);
            });
            underlyingData.push(dataTableRow);
        }

        var $grid = $('<div/>');
        $grid.dxDataGrid({
            height: 500,
            scrolling: {
                mode: 'virtual'
            },
            dataSource: underlyingData
        });

        var popup = $("#myPopup").data("dxPopup");
        $popupContent = popup.content();
        $popupContent.empty();
        $popupContent.append($grid);
        popup.show();
    });
}

function initPopup() {
    $("#myPopup").dxPopup({
        width: 800, height: 600,
        title: "Underlying data",
        showCloseButton: true
    });
}

Methods

GetDataMembers Method

Returns an array of data members available in a data source.

Declaration

GetDataMembers(): string[]

Returns

Type Description
string[]

An array of string values that represent data members available in a data source.

GetRequestDataError Method

Returns a callstack containing the error caused by an unsuccessful request for underlying data.

Declaration

GetRequestDataError(): string

Returns

Type Description
string

A String representing a callstack containing the error caused by an unsuccessful request for underlying data.

Remarks

The ASPxClientDashboardItemUnderlyingData.IsDataReceived method returns whether a request for underlying data was successful. If data was not received, use the GetRequestDataError method to obtain a callstack containing the cause of the error.

See Also

GetRowCount Method

Gets the number of rows in the underlying data set.

Declaration

GetRowCount(): number

Returns

Type Description
number

An integer value that specifies the number of rows in the underlying data set.

GetRowValue(rowIndex, dataMember) Method

Returns the value of the specified cell within the underlying data set.

Declaration

GetRowValue(rowIndex: number, dataMember: string): any

Parameters

Name Type Description
rowIndex number

An integer value that specifies the zero-based index of the required row.

dataMember string

A String that specifies the required data member.

Returns

Type Description
any

An object that represents the value of the specified cell.

IsDataReceived Method

Returns whether a request for underlying data was successful.

Declaration

IsDataReceived(): boolean

Returns

Type Description
boolean

true, if the request for underlying data was successful; otherwise, false.

Remarks

The IsDataReceived method returns whether a request for underlying data was successful. If data was not received, use the ASPxClientDashboardItemUnderlyingData.GetRequestDataError method to obtain a callstack containing the cause of the error.

See Also