Skip to content

Commit e1f80f2

Browse files
committed
DataGrid ExcelJSExportMultipleGrids interface/arraystore
1 parent 4e6ab6e commit e1f80f2

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Angular/app/app.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
66
import {
77
DxButtonModule, DxTabPanelModule, DxDataGridModule, DxDataGridComponent,
88
} from 'devextreme-angular';
9-
import { DataSourceOptions } from 'devextreme-angular/common/data';
9+
import { ArrayStore, DataSourceOptions } from 'devextreme-angular/common/data';
1010
import { Workbook } from 'devextreme-exceljs-fork';
1111
import { saveAs } from 'file-saver-es';
1212
// Our demo infrastructure requires us to use 'file-saver-es'. We recommend that you use the official 'file-saver' package in your applications.
@@ -41,13 +41,19 @@ export class AppComponent {
4141

4242
constructor(service: Service) {
4343
this.priceDataSource = {
44-
store: service.getProducts(),
44+
store: new ArrayStore({
45+
data: service.getProducts(),
46+
key: 'Product_ID',
47+
}),
4548
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
4649
filter: ['Product_ID', '<', 10],
4750
};
4851

4952
this.ratingDataSource = {
50-
store: service.getProducts(),
53+
store: new ArrayStore({
54+
data: service.getProducts(),
55+
key: 'Product_ID',
56+
}),
5157
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
5258
filter: ['Product_ID', '<', 10],
5359
};

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Angular/app/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
22

3-
export class Product {
3+
export interface Product {
44
Product_ID: number;
55

66
Product_Name: string;

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/React/App.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@ import React, { useCallback, useRef } from 'react';
22
import Button from 'devextreme-react/button';
33
import TabPanel, { Item } from 'devextreme-react/tab-panel';
44
import DataGrid, { Column, DataGridRef } from 'devextreme-react/data-grid';
5-
import { DataSourceOptions } from 'devextreme-react/common/data';
5+
import { ArrayStore, DataSourceOptions } from 'devextreme-react/common/data';
66
import { Workbook } from 'devextreme-exceljs-fork';
77
import { saveAs } from 'file-saver-es';
88
import { exportDataGrid } from 'devextreme-react/common/export/excel';
99
import { products } from './data.ts';
1010

1111
const priceDataSource: DataSourceOptions = {
12-
store: products,
12+
store: new ArrayStore({
13+
data: products,
14+
key: 'Product_ID',
15+
}),
1316
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
1417
filter: ['Product_ID', '<', 10],
1518
};
1619

1720
const ratingDataSource: DataSourceOptions = {
18-
store: products,
21+
store: new ArrayStore({
22+
data: products,
23+
key: 'Product_ID',
24+
}),
1925
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
2026
filter: ['Product_ID', '<', 10],
2127
};

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/React/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class Product {
1+
export interface Product {
22
Product_ID: number;
33

44
Product_Name: string;

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Vue/App.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,26 @@ import DxTabPanel, { DxItem } from 'devextreme-vue/tab-panel';
8888
import { DxDataGrid, DxColumn } from 'devextreme-vue/data-grid';
8989
import { Workbook } from 'devextreme-exceljs-fork';
9090
import { type DataGridCell as ExсelDataGridCell, exportDataGrid } from 'devextreme-vue/common/export/excel';
91-
import { type DataSourceOptions } from 'devextreme-vue/common/data';
91+
import { ArrayStore, type DataSourceOptions } from 'devextreme-vue/common/data';
9292
import { products } from './data.ts';
9393
9494
const priceGridRef = ref<DxDataGrid | null>(null);
9595
const ratingGridRef = ref<DxDataGrid | null>(null);
9696
9797
const priceDataSource: DataSourceOptions = {
98-
store: products,
98+
store: new ArrayStore({
99+
data: products,
100+
key: 'Product_ID',
101+
}),
99102
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
100103
filter: ['Product_ID', '<', 10],
101104
};
102105
103106
const ratingDataSource: DataSourceOptions = {
104-
store: products,
107+
store: new ArrayStore({
108+
data: products,
109+
key: 'Product_ID',
110+
}),
105111
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
106112
filter: ['Product_ID', '<', 10],
107113
};

apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Vue/data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
export class Product {
2-
Product_ID: number = 0;
1+
export interface Product {
2+
Product_ID: number;
33

4-
Product_Name: string = '';
4+
Product_Name: string;
55

6-
Product_Sale_Price: number = 0;
6+
Product_Sale_Price: number;
77

8-
Product_Retail_Price: number = 0;
8+
Product_Retail_Price: number;
99

10-
Product_Consumer_Rating: number = 0;
10+
Product_Consumer_Rating: number;
1111

12-
Product_Category: string = '';
12+
Product_Category: string;
1313
}
1414

1515
export const products: Product[] = [

0 commit comments

Comments
 (0)