All docs
V18.2
19.1 (preview)
18.2
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GridItem Class

A Grid dashboard item that visualizes data in tabular form.

Declaration

export class GridItem extends DataDashboardItem

Remarks

The Grid shows data in tabular form while allowing you to summarize against specific measures or calculate differences between them.

wdd-dashboard-items-grid

The following documentation is available: Web Dashboard - Creating a Grid.

Examples

The following example shows how to create the Grid dashboard item, bind it to data and add to the existing dashboard.

Create data items (measures and dimensions) and use the DataItem.dataMember property to bind them to the existing data source's columns. Then use the created measures and dimensions in the dashboard item to bind it to data.

After you add the created dashboard item to the Dashboard.items collection, call the Dashboard.rebuildLayout method to rebuild the dashboard layout and display changes.

// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;

// ...
public createGridItem() { 
    // Create data items for the Grid dashboard item.
    var gridCategoryName = new Model.Dimension();
    gridCategoryName.dataMember("CategoryName");
    var gridProductName = new Model.Dimension();
    gridProductName.dataMember("ProductName");
    var gridUnitPrice = new Model.Measure();
    gridUnitPrice.dataMember("UnitPrice");    

    // Create the Grid dashboard item and bind it to data.
    var gridItem = new Model.GridItem();
    gridItem.name('grid');
    gridItem.dataSource(sqlDataSource.componentName());
    gridItem.dataMember(sqlDataSource.queries()[0].name());

    var gridColumn1 = new Model.GridDimensionColumn(gridItem);
    gridColumn1.dimension(gridProductName);
    gridItem.columns.push(gridColumn1);

    var gridColumn2 = new Model.GridMeasureColumn(gridItem);
    gridColumn2.measure(gridUnitPrice);
    gridItem.columns.push(gridColumn2);

    var gridColumn3 = new Model.GridHyperlinkColumn(gridItem);
    gridColumn3.displayValue(gridCategoryName);
    gridColumn3.uriPattern("http://en.wikipedia.org/wiki/{0}");
    gridItem.columns.push(gridColumn3);

    control.dashboard().items.push(gridItem);
    // ...
    control.dashboard().rebuildLayout();
}

Inheritance

constructor

Initializes a new instance of the GridItem class.

Declaration

constructor(dashboardItemJSON?: any, serializer?: DxDesigner.Analytics.Utils.ModelSerializer)

Parameters

Type Name Description
any dashboardItemJSON

A JSON object used for a dashboard deserialization. Do not pass this parameter directly.

DxDesigner.Analytics.Utils.ModelSerializer serializer

An object used for a dashboard deserialization. Do not pass this parameter directly.

Properties

columns Property

Specifies the collection of grid columns.

Declaration

columns: KnockoutObservableArray<GridColumn>

Property Value

Type Description
KnockoutObservableArray<GridColumn>

An array of GridColumn objects that are grid columns.

Remarks

The Columns collection elements contain data binding information and column display settings.

The Grid dashboard item supports the following column types:

  • GridDimensionColumn - displays grouped values from the bound data item and allows you to provide discrete categorical information.
  • GridHyperlinkColumn - allows you to display hyperlinks in the Grid dashboard item.
  • GridMeasureColumn - displays summaries calculated against data in the bound data item.
  • GridDeltaColumn - is bound to two measures, calculates summaries for both measures, and displays the difference between these summaries.
  • GridSparklineColumn displays values in the bound data item using sparklines.

wdd-grid-columns-overview

See Also

gridColumnTypesMap Property

Declaration

static gridColumnTypesMap: {
    "GridDimensionColumn": {
        constructor: typeof GridDimensionColumn;
        displayName: string;
        icon: string;
    };
    "GridMeasureColumn": {
        constructor: typeof GridMeasureColumn;
        displayName: string;
        icon: string;
    };
    "GridDeltaColumn": {
        constructor: typeof GridDeltaColumn;
        displayName: string;
        icon: string;
    };
    "GridSparklineColumn": {
        constructor: typeof GridSparklineColumn;
        displayName: string;
        icon: string;
    };
    "GridHyperlinkColumn": {
        constructor: typeof GridHyperlinkColumn;
        displayName: string;
        icon: string;
    };
}

Property Value

Type Description
{constructor: GridDeltaColumn, displayName: string, icon: string}
{constructor: GridDimensionColumn, displayName: string, icon: string}
{constructor: GridHyperlinkColumn, displayName: string, icon: string}
{constructor: GridMeasureColumn, displayName: string, icon: string}
{constructor: GridSparklineColumn, displayName: string, icon: string}

gridOptions Property

Provide access to the GridItem's options.

Declaration

gridOptions: GridOptions

Property Value

Type Description
GridOptions

A GridOptions object that contains options of the GridItem.

interactivityOptions Property

Declaration

interactivityOptions: DashboardItemInteractivityOptions

Property Value

Type Description
DashboardItemInteractivityOptions

sparklineArgument Property

Declaration

sparklineArgument: KnockoutObservable<Dimension>

Property Value

Type Description
KnockoutObservable<Dimension>

Methods

createGridColumn(columnJSON) Method

Declaration

createGridColumn(columnJSON: any, serializer?: DxDesigner.Analytics.Utils.ModelSerializer): GridColumn

Parameters

Type Name Description
any columnJSON
DxDesigner.Analytics.Utils.ModelSerializer serializer

An object used for a dashboard deserialization. Do not pass this parameter directly.

Returns

Type Description
GridColumn

getInfo Method

Declaration

getInfo(): DxDesigner.Analytics.Utils.ISerializationsInfo

Returns

Type Description
DxDesigner.Analytics.Utils.ISerializationsInfo