Skip to content

Demo DataGrid ExcelJSExportMultipleGrids remove odata#31567

Merged
flagmanAndrew merged 9 commits into
DevExpress:25_2from
flagmanAndrew:25_2_remove_odata
Nov 12, 2025
Merged

Demo DataGrid ExcelJSExportMultipleGrids remove odata#31567
flagmanAndrew merged 9 commits into
DevExpress:25_2from
flagmanAndrew:25_2_remove_odata

Conversation

@flagmanAndrew

Copy link
Copy Markdown
Contributor

Replace OData with local arrays in the ExcelJSExportMultipleGrids demo

@flagmanAndrew flagmanAndrew requested a review from Raushen November 3, 2025 16:08
@flagmanAndrew flagmanAndrew self-assigned this Nov 3, 2025
@flagmanAndrew flagmanAndrew requested a review from a team as a code owner November 3, 2025 16:08
Copilot AI review requested due to automatic review settings November 3, 2025 16:08
import { Workbook } from 'devextreme-exceljs-fork';
import { type DataGridCell as ExсelDataGridCell, exportDataGrid } from 'devextreme-vue/common/export/excel';
import { type DataSourceOptions } from 'devextreme-vue/common/data';
import { Product, products } from './data.ts';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need Product here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we don't

import { Workbook } from 'devextreme-exceljs-fork';
import { saveAs } from 'file-saver-es';
import { exportDataGrid } from 'devextreme-react/common/export/excel';
import { Product, products } from './data.ts';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need Product here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we don't

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the ExcelJSExportMultipleGrids demo across all framework implementations (jQuery, Angular, React, ReactJs, and Vue) to replace remote OData service calls with local static data arrays. This improves demo performance, reduces external dependencies, and ensures consistent offline functionality.

Key changes:

  • Replaced OData store configuration with local products data arrays
  • Added keyExpr property to jQuery DataGrid configurations
  • Created new data.js/data.ts files containing the Product class and products array for each framework
  • Imported DataSourceOptions type for TypeScript implementations

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/jQuery/index.js Replaced OData store with local products array and added keyExpr property
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/jQuery/index.html Added script reference for data.js file
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/jQuery/data.js New file containing static products array with 9 product records
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Vue/data.ts New file with Product class and typed products array for Vue
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Vue/App.vue Updated to import and use local products data instead of OData
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/ReactJs/data.js New file with Product class (empty) and products array for ReactJs
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/ReactJs/App.js Replaced OData store with local products data, removed unused import
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/React/data.ts New file with Product class and typed products array for React TypeScript
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/React/App.tsx Updated to import and use local products data, added DataSourceOptions typing
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Angular/app/app.service.ts New service file with Product class and products array, following Angular patterns
apps/demos/Demos/DataGrid/ExcelJSExportMultipleGrids/Angular/app/app.component.ts Refactored to use Service dependency injection for data access

@@ -0,0 +1,75 @@
export class Product {}

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty Product class serves no purpose and should be removed. Unlike the TypeScript versions where it defines the type structure, in JavaScript this empty class export is unused and unnecessary.

Suggested change
export class Product {}

Copilot uses AI. Check for mistakes.
import Button from 'devextreme-react/button';
import TabPanel, { Item } from 'devextreme-react/tab-panel';
import DataGrid, { Column, DataGridRef } from 'devextreme-react/data-grid';
import { DataSourceOptions } from 'devextreme-angular/common/data';

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect import path: importing from 'devextreme-angular/common/data' in a React application. This should be 'devextreme-react/common/data' or 'devextreme/common/data' to match the framework being used.

Suggested change
import { DataSourceOptions } from 'devextreme-angular/common/data';
import { DataSourceOptions } from 'devextreme/common/data';

Copilot uses AI. Check for mistakes.
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent whitespace: there's trailing whitespace on line 102. This should be removed to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent whitespace: there's trailing whitespace on line 16. This should be removed to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here there is a trailing space

Product_Consumer_Rating: 4,
Product_Category: "Televisions",
},
]; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add empty line

Product_Consumer_Rating: 4,
Product_Category: "Televisions",
},
]; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add empty line

},
];


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line here

select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line/trailing space here

Copilot AI review requested due to automatic review settings November 4, 2025 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

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

  • [nitpick] Trailing zeros after the decimal point (e.g., 220.00, 330.00) are unnecessary in JavaScript/TypeScript numeric literals and will be stripped by the interpreter. For consistency with other data files and standard practices, these should be written as 220.0 or just 220. This pattern appears throughout all data files in the PR.
<template>

@@ -0,0 +1,75 @@
export class Product {}

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Product class is exported but has no properties or implementation. It should either be removed as unused or properly implemented with properties matching the product data structure (Product_ID, Product_Name, etc.). Since TypeScript versions define the class properly, this appears to be unnecessarily exported.

Suggested change
export class Product {}

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +12
Product_ID: number;

Product_Name: string;

Product_Sale_Price: number;

Product_Retail_Price: number;

Product_Consumer_Rating: number;

Product_Category: string;

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript class properties should use the non-null assertion operator (!) or be marked as optional since they are not initialized in the constructor. The Vue version correctly uses ! for all properties, but this React TypeScript version is missing those assertions.

Suggested change
Product_ID: number;
Product_Name: string;
Product_Sale_Price: number;
Product_Retail_Price: number;
Product_Consumer_Rating: number;
Product_Category: string;
Product_ID!: number;
Product_Name!: string;
Product_Sale_Price!: number;
Product_Retail_Price!: number;
Product_Consumer_Rating!: number;
Product_Category!: string;

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings November 5, 2025 12:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

import Button from 'devextreme-react/button';
import TabPanel, { Item } from 'devextreme-react/tab-panel';
import DataGrid, { Column, DataGridRef } from 'devextreme-react/data-grid';
import { DataSourceOptions } from 'devextreme/common/data';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seem should be
import { DataSourceOptions } from 'devextreme-react/common/data';

@@ -0,0 +1,88 @@
export class Product {
Product_ID!: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not use ! in types

Copilot AI review requested due to automatic review settings November 7, 2025 15:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.

Comment on lines 15 to 19
const ratingDataSource = {
store: {
type: 'odata',
version: 2,
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const ratingDataSource = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines +11 to 15
const priceDataSource: DataSourceOptions = {
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const priceDataSource: DataSourceOptions = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines +17 to 21
const ratingDataSource: DataSourceOptions = {
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const ratingDataSource: DataSourceOptions = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines 103 to 107
const ratingDataSource: DataSourceOptions = {
store: {
type: 'odata',
version: 2,
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const ratingDataSource: DataSourceOptions = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +47
this.priceDataSource = {
store: service.getProducts(),
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array returned by service.getProducts() in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

this.priceDataSource = {
  store: new ArrayStore({
    data: service.getProducts(),
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines 97 to 101
const priceDataSource: DataSourceOptions = {
store: {
type: 'odata',
version: 2,
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const priceDataSource: DataSourceOptions = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +53
this.ratingDataSource = {
store: service.getProducts(),
select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array returned by service.getProducts() in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

this.ratingDataSource = {
  store: new ArrayStore({
    data: service.getProducts(),
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Consumer_Rating', 'Product_Category'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +12
Product_ID: number = 0;

Product_Name: string = '';

Product_Sale_Price: number = 0;

Product_Retail_Price: number = 0;

Product_Consumer_Rating: number = 0;

Product_Category: string = '';

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Product class properties have default initializers (= 0, = '') which is unnecessary for a type-only class. This is inconsistent with the React TypeScript version where the class is used purely for typing. Consider either removing the default initializers or following the pattern in React/data.ts where properties are declared without initializers.

Suggested change
Product_ID: number = 0;
Product_Name: string = '';
Product_Sale_Price: number = 0;
Product_Retail_Price: number = 0;
Product_Consumer_Rating: number = 0;
Product_Category: string = '';
Product_ID: number;
Product_Name: string;
Product_Sale_Price: number;
Product_Retail_Price: number;
Product_Consumer_Rating: number;
Product_Category: string;

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 14
const priceDataSource = {
store: {
type: 'odata',
version: 2,
url: 'https://js.devexpress.com/Demos/DevAV/odata/Products',
key: 'Product_ID',
},
store: products,
select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
filter: ['Product_ID', '<', 10],
};

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Using a raw array directly as the store value when the DataSource also uses select and filter operations may not work correctly. DevExtreme DataSource's select and filter are designed to work with store objects (like ArrayStore), not raw arrays. The jQuery implementation correctly wraps the array in an ArrayStore. Consider wrapping the products array in an ArrayStore with a key property:

import ArrayStore from 'devextreme/data/array_store';

const priceDataSource = {
  store: new ArrayStore({
    data: products,
    key: 'Product_ID',
  }),
  select: ['Product_ID', 'Product_Name', 'Product_Sale_Price', 'Product_Retail_Price'],
  filter: ['Product_ID', '<', 10],
};

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings November 10, 2025 12:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

import { Workbook } from 'devextreme-exceljs-fork';
import { saveAs } from 'file-saver-es';
import { exportDataGrid } from 'devextreme-react/common/export/excel';
import { products } from './data.ts';

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .ts file extension should be omitted in TypeScript imports. In TypeScript/JavaScript module systems, file extensions are typically not included for local modules as the bundler/compiler resolves them automatically. Change to import { products } from './data';

Suggested change
import { products } from './data.ts';
import { products } from './data';

Copilot uses AI. Check for mistakes.
import { type DataGridCell as ExсelDataGridCell, exportDataGrid } from 'devextreme-vue/common/export/excel';
import { type DataSourceOptions } from 'devextreme-vue/common/data';
import { ArrayStore, type DataSourceOptions } from 'devextreme-vue/common/data';
import { products } from './data.ts';

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .ts file extension should be omitted in TypeScript imports. In TypeScript/JavaScript module systems, file extensions are typically not included for local modules as the bundler/compiler resolves them automatically. Change to import { products } from './data';

Suggested change
import { products } from './data.ts';
import { products } from './data';

Copilot uses AI. Check for mistakes.
@flagmanAndrew flagmanAndrew merged commit 1470d6c into DevExpress:25_2 Nov 12, 2025
104 of 109 checks passed
@flagmanAndrew flagmanAndrew deleted the 25_2_remove_odata branch November 12, 2025 09:06
flagmanAndrew added a commit that referenced this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants