The PivotGridDataSource is an object that provides an API for processing data from an underlying store. This object is used in the PivotGrid UI component.
jQuery$(function() { var pivotGridDataSource = new DevExpress.data.PivotGridDataSource({ store: { // ... // Underlying store is configured here // ... }, fields: [{ area: "column", dataField: "OrderDate", dataType: "date" }, { area: "row", dataField: "ShipCity" }, { area: "data", summaryType: "count" }] }); $("#pivotGridContainer").dxPivotGrid({ dataSource: pivotGridDataSource }); });Angular
import PivotGridDataSource from "devextreme/ui/pivot_grid/data_source"; import { DxPivotGridModule } from "devextreme-angular"; // ... export class AppComponent { pivotGridDataSource: PivotGridDataSource; constructor () { this.pivotGridDataSource = new PivotGridDataSource({ store: { // ... // Underlying store is configured here // ... }, fields: [{ area: "column", dataField: "OrderDate", dataType: "date" }, { area: "row", dataField: "ShipCity" }, { area: "data", summaryType: "count" }] }); } } @NgModule({ imports: [ // ... DxPivotGridModule ], // ... })
<dx-pivot-grid [dataSource]="pivotGridDataSource"> </dx-pivot-grid>Vue
<template> <DxPivotGrid :data-source="pivotGridDataSource" /> </template> <script> import PivotGridDataSource from 'devextreme/ui/pivot_grid/data_source'; import DxPivotGrid from 'devextreme-vue/pivot-grid'; const pivotGridDataSource = new PivotGridDataSource({ store: { // ... // Underlying store is configured here // ... }, fields: [{ area: 'column', dataField: 'OrderDate', dataType: 'date' }, { area: 'row', dataField: 'ShipCity' }, { area: 'data', summaryType: 'count' }] }); export default { components: { DxPivotGrid }, data() { return { pivotGridDataSource } } } </script>React
import React from 'react'; import PivotGridDataSource from 'devextreme/ui/pivot_grid/data_source'; import DxPivotGrid from 'devextreme-react/pivot-grid'; const pivotGridDataSource = new PivotGridDataSource({ store: { // ... // Underlying store is configured here // ... }, fields: [{ area: 'column', dataField: 'OrderDate', dataType: 'date' }, { area: 'row', dataField: 'ShipCity' }, { area: 'data', summaryType: 'count' }] }); class App extends React.Component { render() { return ( <PivotGrid dataSource={pivotGridDataSource} /> ); } } export default App;
If you create a
PivotGridDataSourceinstance outside the UI component (as shown above), make sure to
disposeof it when it is no longer used. If the instance is created inside the UI component, it will be disposed of automatically.
The
PivotGridDataSourceis immutable. You cannot change its configuration at runtime. However, you can use its
methodsto manipulate it.
This section describes properties that configure the PivotGridDataSource.
Name Description fieldsConfigures pivot grid fields.
filterSpecifies data filtering conditions. Cannot be used with an XmlaStore.
onChangedA function that is executed after data is successfully loaded.
onFieldsPreparedA function that is executed when all fields are loaded from the store and they are ready to be displayed in the PivotGrid.
onLoadErrorA function that is executed when data loading fails.
onLoadingChangedA function that is executed when the data loading status changes.
paginateSpecifies whether the PivotGridDataSource should load data in portions. Can be used only with an XmlaStore.
remoteOperationsSpecifies whether the data processing operations (filtering, grouping, summary calculation) should be performed on the server.
retrieveFieldsSpecifies whether to auto-generate pivot grid fields from the store's data.
storeConfigures the DataSource's underlying store.
The PivotGridDataSource allows you to specify CustomStore properties in its configuration object, as shown in the following code:
jQueryvar pivotGridDataSource = new DevExpress.data.PivotGridDataSource({ load: function (loadOptions) { // Loading data objects }, byKey: function (key) { // Retrieving a data object by key } });Angular
import PivotGridDataSource from "devextreme/ui/pivot_grid/data_source"; import CustomStore from "devextreme/data/custom_store"; // ... export class AppComponent { pivotGridDataSource: PivotGridDataSource; constructor() { this.pivotGridDataSource = new PivotGridDataSource({ store: new CustomStore({ load: (loadOptions) => { // Loading data objects }, byKey: (key) => { // Retrieving a data object by key } }) }); } }Vue
<script> import PivotGridDataSource from 'devextreme/ui/pivot_grid/data_source'; import CustomStore from 'devextreme/data/custom_store'; const pivotGridDataSource = new PivotGridDataSource({ store: new CustomStore({ load: (loadOptions) => { // Loading data objects }, byKey: (key) => { // Retrieving a data object by key } }) }); export default { // ... data() { return { pivotGridDataSource } } } </script>React
// ... import PivotGridDataSource from 'devextreme/ui/pivot_grid/data_source'; import CustomStore from 'devextreme/data/custom_store'; const pivotGridDataSource = new PivotGridDataSource({ store: new CustomStore({ load: (loadOptions) => { // Loading data objects }, byKey: (key) => { // Retrieving a data object by key } }) }); class App extends React.Component { // ... } export default App;
This section describes methods that control the PivotGridDataSource.
This section describes events that the PivotGridDataSource raises.
Name Description changedRaised after data is successfully loaded.
fieldsPreparedRaised when all fields are loaded from the store and they are ready to be displayed in the PivotGrid.
loadErrorRaised when data loading fails.
loadingChangedRaised when the data loading status changes.
Feel free to share topic-related thoughts here.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4