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

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();
}

constructor

Initializes a new instance of the GridItem class.

Declaration

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

Optional Parameters

Name Type Default Description
dashboardItemJSON any null

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

serializer DxDesigner.Analytics.Utils.ModelSerializer null

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

Properties

columns Property

Specifies the collection of grid columns.

Declaration

columns: ko.ObservableArray<GridColumn>

Property Value

Type Description
ko.ObservableArray<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 five 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

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: ko.Observable<Dimension>

Property Value

Type Description
ko.Observable<Dimension>

Methods

getInfo Method

For internal use.

Declaration

getInfo(): DxDesigner.Analytics.Utils.ISerializationInfoArray

Returns

Type Description
DxDesigner.Analytics.Utils.ISerializationInfoArray