Skip to content

Commit aea64d8

Browse files
authored
Add files via upload
1 parent 62a8b8b commit aea64d8

17 files changed

+1421
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
# how-to-group-data-in-the-angular-pivot-table
2-
A quick start project that shows how to group data in the Angular Pivot Table Component. This project also explains the types of Grouping such as Number, Date, and Custom based on the field type.
1+
# How to Group Data in the Angular Pivot Table
2+
3+
A quick start project that shows how to group data in the Angular Pivot Table Component. This project also explains the types of Grouping such as Number, Date, and Custom based on the field type.
4+
5+
Refer to the following documentation to learn about the Angular Pivot Table component:
6+
https://ej2.syncfusion.com/angular/documentation/pivotview/grouping
7+
8+
Check out this online example of the Angular Pivot Table component:
9+
https://ej2.syncfusion.com/angular/demos/#/material/pivot-table/grouping
10+
11+
## Project prerequisites
12+
Make sure that you have the compatible versions of [Visual Studio Code](https://code.visualstudio.com/download ) and [NodeJS](https://nodejs.org/en/download) or later version in your machine before starting to work on this project.
13+
14+
## How to run this application
15+
To run this application, you need to first clone the `how-to-group-data-in-the-angular-pivot-table` repository and then open it in Visual Studio Code. Now, simply build and run your project to view the output.

angular.json

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"example": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"outputPath": "dist/example",
17+
"index": "src/index.html",
18+
"browser": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
"src/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/styles.css"
29+
],
30+
"scripts": []
31+
},
32+
"configurations": {
33+
"production": {
34+
"budgets": [
35+
{
36+
"type": "initial",
37+
"maximumWarning": "500kb",
38+
"maximumError": "1mb"
39+
},
40+
{
41+
"type": "anyComponentStyle",
42+
"maximumWarning": "2kb",
43+
"maximumError": "4kb"
44+
}
45+
],
46+
"outputHashing": "all"
47+
},
48+
"development": {
49+
"optimization": false,
50+
"extractLicenses": false,
51+
"sourceMap": true
52+
}
53+
},
54+
"defaultConfiguration": "production"
55+
},
56+
"serve": {
57+
"builder": "@angular-devkit/build-angular:dev-server",
58+
"configurations": {
59+
"production": {
60+
"buildTarget": "example:build:production"
61+
},
62+
"development": {
63+
"buildTarget": "example:build:development"
64+
}
65+
},
66+
"defaultConfiguration": "development"
67+
},
68+
"extract-i18n": {
69+
"builder": "@angular-devkit/build-angular:extract-i18n",
70+
"options": {
71+
"buildTarget": "example:build"
72+
}
73+
},
74+
"test": {
75+
"builder": "@angular-devkit/build-angular:karma",
76+
"options": {
77+
"polyfills": [
78+
"zone.js",
79+
"zone.js/testing"
80+
],
81+
"tsConfig": "tsconfig.spec.json",
82+
"assets": [
83+
"src/favicon.ico",
84+
"src/assets"
85+
],
86+
"styles": [
87+
"src/styles.css"
88+
],
89+
"scripts": []
90+
}
91+
}
92+
}
93+
}
94+
}
95+
}

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "example",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^17.2.0",
14+
"@angular/common": "^17.2.0",
15+
"@angular/compiler": "^17.2.0",
16+
"@angular/core": "^17.2.0",
17+
"@angular/forms": "^17.2.0",
18+
"@angular/platform-browser": "^17.2.0",
19+
"@angular/platform-browser-dynamic": "^17.2.0",
20+
"@angular/router": "^17.2.0",
21+
"@syncfusion/ej2-angular-pivotview": "^24.2.5",
22+
"rxjs": "~7.8.0",
23+
"tslib": "^2.3.0",
24+
"zone.js": "~0.14.3"
25+
},
26+
"devDependencies": {
27+
"@angular-devkit/build-angular": "^17.2.0",
28+
"@angular/cli": "^17.2.0",
29+
"@angular/compiler-cli": "^17.2.0",
30+
"@types/jasmine": "~5.1.0",
31+
"jasmine-core": "~5.1.0",
32+
"karma": "~6.4.0",
33+
"karma-chrome-launcher": "~3.2.0",
34+
"karma-coverage": "~2.2.0",
35+
"karma-jasmine": "~5.1.0",
36+
"karma-jasmine-html-reporter": "~2.1.0",
37+
"typescript": "~5.3.2"
38+
}
39+
}

src/app/app.component.css

Whitespace-only changes.

src/app/app.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ejs-pivotview [dataSourceSettings]="dataSourceSettings" height="500px" width="100%"
2+
showGroupingBar='true' allowGrouping="true"
3+
></ejs-pivotview>

src/app/app.component.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { AppComponent } from './app.component';
3+
4+
describe('AppComponent', () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
imports: [AppComponent],
8+
}).compileComponents();
9+
});
10+
11+
it('should create the app', () => {
12+
const fixture = TestBed.createComponent(AppComponent);
13+
const app = fixture.componentInstance;
14+
expect(app).toBeTruthy();
15+
});
16+
17+
it(`should have the 'example' title`, () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app.title).toEqual('example');
21+
});
22+
23+
it('should render title', () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
fixture.detectChanges();
26+
const compiled = fixture.nativeElement as HTMLElement;
27+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, example');
28+
});
29+
});

src/app/app.component.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Component } from '@angular/core';
2+
import { RouterOutlet } from '@angular/router';
3+
import { PivotViewModule,IDataOptions, IDataSet, GroupingBarService, GroupingService } from '@syncfusion/ej2-angular-pivotview';
4+
declare var require: any;
5+
let data: any = require('./gData.json');
6+
7+
@Component({
8+
selector: 'app-root',
9+
standalone: true,
10+
imports: [RouterOutlet,PivotViewModule ],
11+
providers: [GroupingBarService, GroupingService],
12+
templateUrl: './app.component.html',
13+
styleUrl: './app.component.css'
14+
})
15+
export class AppComponent {
16+
title = 'example';
17+
18+
public dataSourceSettings: IDataOptions | undefined;
19+
ngOnInit(): void {
20+
this.dataSourceSettings = {
21+
dataSource: data as IDataSet[],
22+
rows: [
23+
{ name: 'Products', caption: 'Products'},
24+
//{ name: 'Date', caption: 'Date' }
25+
],
26+
columns: [
27+
{ name: 'Product_ID', caption: 'Product ID' },
28+
{ name: 'Products', caption: 'Products' }],
29+
values: [
30+
{ name: 'Sold', caption: 'Unit Sold' },
31+
{ name: 'Amount', caption: 'Sold Amount' }],
32+
formatSettings: [
33+
{ name: 'Amount', format: 'C0' },
34+
{ name: 'Sold', format: 'N0' },
35+
{ name: 'Date', type: 'date', format: 'dd/MM/yyyy-hh:mm a' }
36+
],
37+
groupSettings: [
38+
{ name: 'Products', type: 'Custom',
39+
customGroups: [{ groupName: 'Products-3',
40+
items: ['Gloves','Jerseys','Shorts']}] }
41+
]
42+
};
43+
}
44+
}

src/app/app.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApplicationConfig } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
4+
import { routes } from './app.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [provideRouter(routes)]
8+
};

src/app/app.routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [];

0 commit comments

Comments
 (0)