Skip to main content

GridContext Class

Provides a connection between data item containers from the Columns section and an underlying control’s columns.

Declaration

export class GridContext

Remarks

The following code snippet shows how to use GridContext to get a Grid item’s columns:

var Model = DevExpress.Dashboard.Model;

function onItemWidgetOptionsPrepared(args) {
    if(args.dashboardItem instanceof Model.GridItem) {
        var gridOptions = args.options;
        if(gridOptions.columns) {
            gridOptions.columns.forEach(function(columnOptions) {
                var dashboardColumn = args.gridContext.getDashboardItemColumn(columnOptions)
                if(dashboardColumn instanceof Model.GridDimensionColumn && dashboardColumn.dimension().dataMember() === "id") {
                    columnOptions.alignment = 'center';
                }
            })
        }
    }
}

constructor(_dashboardItem)

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

Declaration

constructor(
    _dashboardItem: DevExpress.Dashboard.Model.GridItem
)

Parameters

Name Type
_dashboardItem GridItem

Methods

getDashboardItemColumn(columnOptions) Method

Declaration

getDashboardItemColumn(
    columnOptions: DevExpress.ui.dxDataGrid.ColumnBase
): DevExpress.Dashboard.Model.GridColumn

Parameters

Name Type
columnOptions ColumnBase

Returns

Type
GridColumn