dashboard-js-devexpress-dot-dashboard-dot-model-d432131d.md
A Grid dashboard item that visualizes data in tabular form.
export class GridItem extends DataDashboardItem
The Grid shows data in tabular form while allowing you to summarize against specific measures or calculate differences between them.
The following documentation is available: Web Dashboard - Creating a Grid.
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();
}
SerializableModel TypedSerializableModel DashboardItem DataDashboardItem GridItem
Initializes a new instance of the GridItem class.
constructor(
dashboardItemJSON?: any,
serializer?: DevExpress.Analytics.Utils.ModelSerializer
)
| Name | Type | Description |
|---|---|---|
| dashboardItemJSON | any |
A JSON object used for dashboard deserialization. Do not pass this parameter directly.
| | serializer | ModelSerializer |
An object used for dashboard deserialization. Do not pass this parameter directly.
|
Provides access to the Grid’s column filter settings.
columnFilterOptions: DevExpress.Dashboard.Model.GridColumnFilterOptions
| Type | Description |
|---|---|
| GridColumnFilterOptions |
A GridColumnFilterOptions object that contains the Grid’s column filter options.
|
Column filters allow users to search data in the Grid item. These filters do not affect data outside the Grid.
true to enable the filter row.true to reflect changes in column values and recalculate totals based on the applied column filter.The following example shows how to enable the filter row for each Grid item after a dashboard is initialized:
function onDashboardInitialized(args) {
args.dashboard.items().forEach(element => {
if (element instanceof GridItem) {
element.columnFilterOptions.showFilterRow(true);
}
});
}
Specifies the collection of grid columns.
columns: ko.ObservableArray<DevExpress.Dashboard.Model.GridColumn>
| Type | Description |
|---|---|
| ObservableArray<GridColumn> |
An array of GridColumn objects that are grid columns.
|
The Columns collection elements contain data binding information and column display settings.
The Grid dashboard item supports five column types:
See Also
Provide access to the GridItem‘s options.
gridOptions: DevExpress.Dashboard.Model.GridOptions
| Type | Description |
|---|---|
| GridOptions |
A GridOptions object that contains options of the GridItem.
|
interactivityOptions: DevExpress.Dashboard.Model.DashboardItemInteractivityOptions
| Type |
|---|
| DashboardItemInteractivityOptions |
sparklineArgument: ko.Observable<DevExpress.Dashboard.Model.Dimension>
| Type |
|---|
| Observable<Dimension> |