Skip to content

SyncfusionExamples/data-binding-in-react-pivot-table-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Data Binding in React Pivot Table Component

License React TypeScript Syncfusion EJ2

Quick-start React project demonstrating local and remote data binding to Syncfusion's powerful PivotTable component with TypeScript support β€” includes practical JSON binding examples, remote data source integration patterns, and production-ready component configuration.

πŸ” Overview

This repository provides a comprehensive, production-ready example for implementing data binding in React Pivot Table components using Syncfusion's EJ2 library. Whether you're building business intelligence dashboards, financial reporting tools, or data analytics applications, this project demonstrates modern React best practices for dynamic data visualization.

✨ Key Features

  • βœ… Local Data Binding: Bind JSON data directly to pivot table components
  • βœ… Remote Data Binding: Connect to external API data sources with dynamic loading
  • βœ… Syncfusion EJ2 Library: Leverages feature-rich React components from Syncfusion
  • βœ… TypeScript Support: Full type-safe development with modern React patterns
  • βœ… Responsive Design: Optimized for desktop and tablet viewports
  • βœ… Production Ready: Configured with best practices and clean code structure
  • βœ… Quick Start Setup: Easy-to-follow configuration with zero-config execution

πŸ“‹ Prerequisites

  • Node.js: LTS v18 or higher β€” Download
  • npm: v9 or higher (included with Node.js)
  • React: v18 or higher
  • TypeScript: v5 or higher
  • Visual Studio Code: Latest stable version (recommended)

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/SyncfusionExamples/data-binding-in-react-pivot-table-component.git
cd data-binding-in-react-pivot-table-component

2. Install Dependencies

npm install

3. Start Development Server

npm start

The application will automatically open at http://localhost:3000.

🎯 Quick Start Examples

Local Data Binding

Bind JSON data directly to your pivot table:

import { PivotViewComponent, Inject, PivotFieldList } from '@syncfusion/ej2-react-pivotview';

const data = [
  { ProductID: 1, ProductName: 'Laptop', Amount: 5000, Region: 'North' },
  { ProductID: 2, ProductName: 'Desktop', Amount: 3500, Region: 'South' }
];

export function LocalDataBinding() {
  return (
    <PivotViewComponent dataSource={data} height="400">
      <Inject services={[PivotFieldList]} />
    </PivotViewComponent>
  );
}

Remote Data Binding

Connect to external data sources:

const dataSource = {
  url: 'https://api.example.com/data',
  adaptor: new JsonAdaptor()
};

<PivotViewComponent dataSource={dataSource} height="400">
  <Inject services={[PivotFieldList]} />
</PivotViewComponent>

πŸ—‚οΈ Project Structure

data-binding-in-react-pivot-table-component/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.tsx                 # Main application component
β”‚   β”œβ”€β”€ App.css                 # Application styles
β”‚   β”œβ”€β”€ App.test.tsx            # Component tests
β”‚   β”œβ”€β”€ index.tsx               # React entry point
β”‚   β”œβ”€β”€ index.css               # Global styles
β”‚   β”œβ”€β”€ csvdata.ts              # Sample CSV data
β”‚   β”œβ”€β”€ data.js                 # Sample JSON data
β”‚   └── reportWebVitals.ts      # Performance metrics
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html              # HTML template
β”‚   β”œβ”€β”€ manifest.json           # PWA manifest
β”‚   └── robots.txt              # SEO robots file
β”œβ”€β”€ package.json                # Dependencies and scripts
β”œβ”€β”€ tsconfig.json               # TypeScript configuration
└── README.md                   # This file

πŸ’‘ Usage & Examples

Running Data Binding Examples

The project includes comprehensive examples for both local and remote data binding patterns. Explore the component implementations to understand:

  • How to structure pivot table configurations
  • Binding data from JSON sources
  • Connecting to REST APIs
  • Handling dynamic data updates
  • Configuring rows, columns, and values

Sample Data Files

  • csvdata.ts: Pre-configured CSV data for pivot table examples
  • data.js: JSON formatted sample data for local binding demonstrations

βš™οΈ Configuration

Available Scripts

  • npm start β€” Start the development server
  • npm test β€” Run test suite
  • npm run build β€” Build production bundle
  • npm run eject β€” Eject Create React App (not reversible)

Environment Configuration

Configure data sources and API endpoints in your component files:

const API_BASE_URL = process.env.REACT_APP_API_URL || 'http://localhost:5000';
const DATA_SOURCE_URL = `${API_BASE_URL}/api/data`;

πŸ”§ Troubleshooting

Port already in use?

npm start -- --port 3001

Syncfusion license key issues? Check Syncfusion documentation for registration: https://www.syncfusion.com/products/react

Data not displaying? Verify data structure matches expected schema and check browser console for errors.

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.

πŸ“„ License

This project is licensed under the Syncfusion Community License. See Syncfusion License for details.

πŸ“š Resources

πŸ†˜ Support

For issues, questions, or suggestions:

  • πŸ“§ Open an issue on GitHub
  • πŸ’¬ Check existing documentation
  • 🌐 Visit Syncfusion support forums

About

A quick-start project that shows how to bind local and remote data to the React ListBox component of Syncfusion.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors