Skip to content

SyncfusionExamples/syncfusion-react-pivotview-component-in-nextjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Š Getting Started โ€” React Pivot Table Component (Syncfusion EJ2) + Next.js

License Nextjs Last Updated Syncfusion Version Node.js npm

A small Next.js sample showcasing how to integrate the Syncfusion React Pivot Table (PivotView) component with the Next.js App Router. This repo demonstrates a client-side app/page.tsx usage, sample datasource and theme imports so you can run the demo locally in minutes. ๐Ÿš€

๐Ÿ” Quick overview

  • What: Example Next.js app that integrates the Syncfusion React Pivot Table (@syncfusion/ej2-react-pivotview).
  • Why: Shows how to use Syncfusion interactive components with the Next.js App Router (client components + CSS imports).
  • Who: Frontend developers building data-visualization dashboards using React + Next.js.

โœจ Key Features

Feature Description Benefit
๐ŸŽฏ Field List Interface Dynamically add, remove, and rearrange data fields at runtime Empowers end-users to customize reports without code modifications
๐Ÿ“Š Flexible Data Binding Supports relational data binding with hierarchical structures Handle complex multi-dimensional business data
๐Ÿงฎ Calculated Fields Create custom formulas combining multiple data fields Advanced data analysis and business metric computation
๐Ÿ’ฑ Data Formatting Display values in currency, percentages, and custom formats Professional presentation of numerical data
โ†•๏ธ Multi-Level Sorting Sort by multiple fields with ascending/descending control Enhanced data exploration and trend analysis
๐Ÿ”— Advanced Filtering Filter by single or multiple criteria across all dimensions Focused data analysis and drill-down exploration
๐Ÿ“ฑ Responsive Design Adapts seamlessly to desktop, tablet, and mobile screens Universal accessibility across all devices
๐Ÿ“ค Export Functionality Export pivot table data to Excel and PDF formats Generate shareable reports and archives
๐ŸŽจ Theme Support Multiple Tailwind and Bootstrap themes available Consistent branding and visual customization
โšก Performance Optimized Efficient rendering with virtual scrolling Handle large datasets without performance degradation

โœ… Highlights

  • Ready-to-run demo with sample pivotData.
  • Uses Syncfusion module injection (CalculatedField, FieldList).
  • Shows theme / CSS imports to app/globals.css for consistent styling.

๐Ÿ”ง Prerequisites

  • Node.js 18 LTS or later
  • npm (or yarn)

๐Ÿš€ Quick start

Clone, install and run the app locally:

git clone https://github.com/SyncfusionExamples/syncfusion-react-pivotview-component-in-nextjs
cd syncfusion-react-pivotview-component-in-nextjs
npm install
npm run dev

Open http://localhost:3000 to view the running sample.


๐Ÿ“ Whatโ€™s included

  • app/datasource.tsx โ€” sample pivotData used by the demo.
  • app/page.tsx โ€” client component mounting PivotViewComponent and injecting services.
  • app/globals.css โ€” recommended place to add Syncfusion theme CSS imports.

๐Ÿ”Œ How this sample was prepared (key steps)

  1. Install the Syncfusion PivotView package:
npm install @syncfusion/ej2-react-pivotview --save
  1. Import Syncfusion theme CSS into app/globals.css (example Tailwind3 theme imports):
@import '../node_modules/@syncfusion/ej2-base/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-grids/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-navigations/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-calendars/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-react-pivotview/styles/tailwind3.css';
/* add other component CSS as needed */
  1. Make app/page.tsx a client component and mount PivotViewComponent:
'use client'
import { CalculatedField, FieldList, Inject, PivotViewComponent } from '@syncfusion/ej2-react-pivotview';
import { DataSourceSettingsModel } from '@syncfusion/ej2-pivotview/src/model/datasourcesettings-model';
import { pivotData } from './datasource';

export default function Home() {
	const dataSourceSettings: DataSourceSettingsModel = {
		columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
		dataSource: pivotData as any[],
		expandAll: false,
		filters: [],
		drilledMembers: [{ name: 'Country', items: ['Germany'] }],
		formatSettings: [{ name: 'Amount', format: 'C0' }],
		rows: [{ name: 'Country' }, { name: 'Products' }],
		values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }]
	};

	return (
		<>
			<h2>Syncfusion React Pivot Table Component</h2>
			<PivotViewComponent id='PivotView' height={350} dataSourceSettings={dataSourceSettings} allowCalculatedField={true} showFieldList={true}><Inject services={[CalculatedField, FieldList]} />
			</PivotViewComponent>
		</>
	)
}
  1. Provide sample pivotData in app/datasource.tsx (array of objects) โ€” the demo ships with this file.

โš™๏ธ Configuration & customization

  • Theme: Swap the Tailwind3 CSS imports to a different Syncfusion theme file if you prefer (e.g., fabric.css, material.css).
  • Localization: Use Syncfusion localization utilities if needed.
  • Lazy-loading: Consider dynamic imports for PivotView if server-side rendering is used elsewhere.

๐Ÿงฉ Files structure (important files)

  • app/datasource.tsx โ€” sample data
  • app/page.tsx โ€” demo page (client component)
  • app/globals.css โ€” place to import Syncfusion themes
  • next.config.js, package.json, tsconfig.json โ€” project configs

๐Ÿ›  Troubleshooting

  • If components donโ€™t style correctly, ensure the theme CSS is imported into app/globals.css and there are no conflicting global rules.
  • If interactive features fail, verify app/page.tsx includes 'use client' at the top.

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License & Support

License

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

Support & Resources

Additional Resources


โšก Performance Tips

  • โœ… Use virtual scrolling for large datasets (1000+ rows)
  • โœ… Enable lazy loading for remote data sources
  • โœ… Optimize format settings to reduce rendering overhead
  • โœ… Use filter and drill-down to reduce data volume displayed
  • โœ… Consider server-side aggregation for very large datasets

About

This application demonstrates the usage of the Syncfusion React Pivot Table component in Next.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages