Skip to content

Commit 64edb06

Browse files
Merge pull request #444 from Syncfusion-Content/hotfix/hotfix-v25.2.3
DOCINFRA-2341_merged_using_automation
2 parents 109827b + 7790cf0 commit 64edb06

File tree

34 files changed

+44983
-265
lines changed

34 files changed

+44983
-265
lines changed

ej2-react/code-snippet/pivot-table/default-cs299/app/index.jsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{% raw %}
21
import * as React from 'react';
32
import * as ReactDOM from 'react-dom';
43
import { PivotViewComponent } from '@syncfusion/ej2-react-pivotview';
@@ -30,33 +29,33 @@ function App() {
3029
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }]
3130
};
3231
let pivotObj;
33-
function ondataBound(args) {
34-
var dataSource = JSON.parse(pivotObj.getPersistData()).dataSourceSettings.dataSource;
35-
var a = document.getElementById('save');
36-
var mime_type = 'application/octet-stream'; // text/html, image/png, et c
32+
function ondataBound() {
33+
const dataSource = JSON.parse(pivotObj.getPersistData()).dataSourceSettings.dataSource;
34+
const a = document.getElementById('save');
35+
const mime_type = 'application/octet-stream'; // text/html, image/png, et c
3736
a.setAttribute('download', 'pivot.JSON');
3837
a.href = 'data:' + mime_type + ';base64,' + btoa(JSON.stringify(dataSource) || '');
3938
document.getElementById('files').addEventListener('change', readBlob, false);
4039
}
41-
function readBlob(args) {
42-
var files = document.getElementById('load').files;
43-
var file = files[0];
44-
var start = 0;
45-
var stop = file.size - 1;
46-
var reader = new FileReader();
40+
function readBlob() {
41+
const files = document.getElementById('files').files;
42+
const file = files[0];
43+
const start = 0;
44+
const stop = file.size - 1;
45+
const reader = new FileReader();
4746
reader.onloadend = function (evt) {
4847
if (evt.target.readyState == FileReader.DONE) {
49-
pivotObj.dataSource = JSON.parse(evt.target.result);
48+
pivotObj.dataSourceSettings = JSON.parse(evt.target.result);
5049
}
5150
};
52-
var blob = file.slice(start, stop + 1);
51+
const blob = file.slice(start, stop + 1);
5352
reader.readAsBinaryString(blob);
53+
document.getElementById('files').value = '';
5454
}
5555
return (<div className='control-pane'>
5656
<div><style>{SAMPLE_CSS}</style><PivotViewComponent id='PivotView' ref={d => pivotObj = d} dataSourceSettings={dataSourceSettings} width={'100%'} height={350} gridSettings={{ columnWidth: 140 }} dataBound={ondataBound.bind(this)}></PivotViewComponent></div><a id="save" class="btn btn-primary">Save</a><div class="fileUpload btn btn-primary"><span>Load</span><input id="files" type="file" class="upload"/></div>
5757
</div>);
5858
}
5959
;
6060
export default App;
61-
ReactDOM.render(<App />, document.getElementById('sample'));
62-
{% endraw %}
61+
ReactDOM.render(<App />, document.getElementById('sample'));
Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
{% raw %}
2-
3-
41
import * as React from 'react';
52
import * as ReactDOM from 'react-dom';
6-
import { IDataOptions, IDataSet, Inject, PivotViewComponent } from '@syncfusion/ej2-react-pivotview';
3+
import { IDataOptions, IDataSet, PivotViewComponent } from '@syncfusion/ej2-react-pivotview';
74
import { pivotData } from './datasource';
85

96
const SAMPLE_CSS = `
@@ -25,46 +22,46 @@ const SAMPLE_CSS = `
2522
}`;
2623

2724
function App() {
28-
let dataSourceSettings: IDataOptions = {
29-
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
30-
dataSource: pivotData as IDataSet[],
31-
filters: [],
32-
formatSettings: [{ name: 'Amount', format: 'C0' }],
33-
rows: [{ name: 'Country' }, { name: 'Products' }],
34-
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }]
35-
};
36-
let pivotObj: PivotViewComponent;
25+
let dataSourceSettings: IDataOptions = {
26+
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
27+
dataSource: pivotData as IDataSet[],
28+
filters: [],
29+
formatSettings: [{ name: 'Amount', format: 'C0' }],
30+
rows: [{ name: 'Country' }, { name: 'Products' }],
31+
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }]
32+
};
33+
let pivotObj: PivotViewComponent;
3734

38-
function ondataBound(args: any): void {
39-
var dataSource = JSON.parse(pivotObj.getPersistData()).dataSourceSettings.dataSource;
40-
var a = document.getElementById('save');
41-
var mime_type = 'application/octet-stream'; // text/html, image/png, et c
35+
function ondataBound(): void {
36+
const dataSource = JSON.parse(pivotObj.getPersistData()).dataSourceSettings;
37+
const a: HTMLAnchorElement = document.getElementById('save') as HTMLAnchorElement;
38+
const mime_type = 'application/octet-stream'; // text/html, image/png, et c
4239
a.setAttribute('download', 'pivot.JSON');
43-
a.href = 'data:'+ mime_type +';base64,'+ btoa(JSON.stringify(dataSource) || '');
44-
document.getElementById('files').addEventListener('change', readBlob, false);
40+
a.href = 'data:' + mime_type + ';base64,' + btoa(JSON.stringify(dataSource) || '');
41+
(document.getElementById('files') as HTMLInputElement).addEventListener('change', readBlob, false);
4542
}
46-
function readBlob(args: any): void {
47-
var files = document.getElementById('load').files;
48-
var file = files[0];
49-
var start = 0;
50-
var stop = file.size - 1;
51-
var reader = new FileReader();
52-
reader.onloadend = function(evt) {
53-
if (evt.target.readyState == FileReader.DONE) {
54-
pivotObj.dataSource = JSON.parse(evt.target.result);
43+
44+
function readBlob(): void {
45+
const files: FileList = (document.getElementById('files') as HTMLInputElement).files as FileList;
46+
const file: File = files[0];
47+
const start: number = 0;
48+
const stop: number = file.size - 1;
49+
const reader: FileReader = new FileReader();
50+
reader.onloadend = function (evt: ProgressEvent<FileReader>) {
51+
if ((evt.target as FileReader).readyState == FileReader.DONE) {
52+
pivotObj.dataSourceSettings = JSON.parse((evt.target as FileReader).result as string);
5553
}
5654
};
57-
var blob = file.slice(start, stop + 1);
55+
const blob: Blob = file.slice(start, stop + 1);
5856
reader.readAsBinaryString(blob);
57+
(document.getElementById('files') as HTMLInputElement).value = '';
5958
}
6059

61-
return (<div className='control-pane'>
62-
<div><style>{SAMPLE_CSS}</style><PivotViewComponent id='PivotView' ref={d => pivotObj = d} dataSourceSettings={dataSourceSettings} width={'100%'} height={350} gridSettings={{ columnWidth: 140 }} dataBound={ondataBound.bind(this)}></PivotViewComponent></div><a id="save" class="btn btn-primary">Save</a><div class="fileUpload btn btn-primary"><span>Load</span><input id="files" type="file" class="upload" /></div>
63-
</div>);
60+
return (<div className='control-pane'><div><style>{SAMPLE_CSS}</style>
61+
<PivotViewComponent id='PivotView' ref={d => pivotObj = d} dataSourceSettings={dataSourceSettings} width={'100%'} height={350}
62+
gridSettings={{ columnWidth: 140 }} dataBound={ondataBound.bind(this)}></PivotViewComponent></div>
63+
<a id="save" className="btn btn-primary">Save</a><div className="fileUpload btn btn-primary"><span>Load</span><input id="files" type="file" className="upload" /></div>
64+
</div>);
6465
};
6566
export default App;
66-
ReactDOM.render(<App />, document.getElementById('sample'));
67-
68-
69-
70-
{% endraw %}
67+
ReactDOM.render(<App />, document.getElementById('sample'));
Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,56 @@
1-
2-
3-
import { IDataOptions, IDataSet, PivotViewComponent, AggregateEventArgs } from '@syncfusion/ej2-react-pivotview';
1+
import { PivotViewComponent, FieldList, Inject } from '@syncfusion/ej2-react-pivotview';
2+
import { Uploader } from '@syncfusion/ej2-inputs';
43
import * as React from 'react';
54
import * as ReactDOM from 'react-dom';
6-
import { pivotData } from './datasource';
75

86
function App() {
9-
10-
let dataSourceSettings: IDataOptions = {
11-
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
12-
dataSource: pivotData as IDataSet[],
13-
expandAll: false,
14-
filters: [],
15-
drilledMembers: [{ name: 'Country', items: ['France'] }],
16-
formatSettings: [{ name: 'Amount', format: 'C2'}],
17-
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
18-
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
19-
rows: [{ name: 'Country' }, { name: 'Products' }],
20-
}
217
let pivotObj: PivotViewComponent;
8+
let input: HTMLInputElement
9+
let isInitial = true;
10+
11+
function ondataBound(): void {
12+
if (isInitial) {
13+
// Step 1: Initiate the file uploader
14+
let uploadObj: Uploader = new Uploader();
15+
uploadObj.appendTo('#fileupload');
16+
input = document.querySelector('input[type="file"]') as HTMLInputElement;
17+
// Step 2: Add the event listener which fires when the *.CSV file is uploaded.
18+
input.addEventListener('change', loadCSV, false);
19+
isInitial = false;
20+
}
21+
}
2222

23-
function aggregateCell(args: AggregateEventArgs): void {
24-
args.skipFormatting = true;
23+
function loadCSV() {
24+
// Step 3: Initiate the file reader
25+
const reader: FileReader = new FileReader();
26+
reader.onload = function () {
27+
const Result: string[][] = [];
28+
// Step 4: Getting the string output which is to be converted as string[][].
29+
let readerResult: string[] = (reader.result as string).split(/\r?\n|\r/);
30+
(Result as string[][]).push(readerResult[0].split(',').map(function (e) { return e.replace(/ /g, '').replace(/^\"(.+)\"$/, "$1"); }));
31+
for (let i: number = 1; i < readerResult.length; i++) {
32+
if (readerResult[i as number] !== '') {
33+
(Result as string[][]).push(readerResult[i as number].split(','));
34+
}
35+
}
36+
pivotObj.dataSourceSettings = {
37+
// Step 5: The string[][] result to be bound as data source
38+
dataSource: Result,
39+
type: 'CSV',
40+
// Step 6: The appropriate report needs to be provided here.
41+
};
42+
}
43+
reader.readAsText(((input as HTMLInputElement).files as FileList)[0]);
44+
input.value = '';
45+
(document.querySelector('.e-upload-files') as HTMLElement).remove();
2546
}
2647

27-
return (<PivotViewComponent ref={d => pivotObj = d} id='PivotView' height={350} aggregateCellInfo={aggregateCell.bind(this)} dataSourceSettings={dataSourceSettings}></PivotViewComponent>);
48+
return (<div className='control-pane'><input type="file" id="fileupload" />
49+
<PivotViewComponent ref={d => pivotObj = d} id='PivotView' height={350} showFieldList={true} dataBound={ondataBound.bind(this)}>
50+
<Inject services={[FieldList]} />
51+
</PivotViewComponent></div>
52+
);
2853
};
2954

3055
export default App;
31-
ReactDOM.render(<App />, document.getElementById('sample'));
32-
33-
34-
56+
ReactDOM.render(<App />, document.getElementById('sample'));

ej2-react/code-snippet/pivot-table/getting-started-cs1/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs1/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs2/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs2/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs3/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs3/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs4/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs4/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs5/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs5/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs6/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs6/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/code-snippet/pivot-table/getting-started-cs7/app/datasource.jsx

Lines changed: 6382 additions & 0 deletions
Large diffs are not rendered by default.

ej2-react/code-snippet/pivot-table/getting-started-cs7/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ System.config({
5050
}
5151
},
5252
packages: {
53-
'app': { main: 'index', defaultExtension: 'tsx' },
53+
'app': { main: 'App', defaultExtension: 'tsx' },
5454
}
5555

5656
});

ej2-react/data/adaptors.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The adaptor can be assigned using the `adaptor` property of the
5454
```ts
5555
import { DataManager, Query, ReturnOption, UrlAdaptor } from '@syncfusion/ej2-data';
5656

57-
const SERVICE_URI: string = 'https://ej2services.syncfusion.com/react/development/api/UrlDataSource';
57+
const SERVICE_URI: string = 'https://services.syncfusion.com/react/production/api/UrlDataSource';
5858

5959
new DataManager({
6060
adaptor: new UrlAdaptor,
@@ -144,7 +144,7 @@ To enable OData query option for Web API, please refer to the [documentation](ht
144144
```ts
145145
import { DataManager, Query, ReturnOption, WebApiAdaptor } from '@syncfusion/ej2-data';
146146

147-
const SERVICE_URI: string = 'https://ej2services.syncfusion.com/react/development/api/Orders';
147+
const SERVICE_URI: string = 'https://services.syncfusion.com/react/production/api/orders';
148148

149149
new DataManager({
150150
adaptor: new WebApiAdaptor,
@@ -311,14 +311,14 @@ export default resolvers;
311311

312312
The query parameters will be send in a string format which contains the below details.
313313

314-
| Parameters | Description |
315-
|-----|-----|
314+
| Parameters | Description |
315+
| ---------------- | ----------------------------------------------------------------------------- |
316316
| `RequiresCounts` | If it is `true` then the total count of records will be included in response. |
317-
| `Skip` | Holds the number of records to skip. |
318-
| `Take` | Holds the number of records to take. |
319-
| `Sorted` | Contains details about current sorted column and its direction. |
320-
| `Where` | Contains details about current filter column name and its constraints. |
321-
| `Group` | Contains details about current Grouped column names. |
317+
| `Skip` | Holds the number of records to skip. |
318+
| `Take` | Holds the number of records to take. |
319+
| `Sorted` | Contains details about current sorted column and its direction. |
320+
| `Where` | Contains details about current filter column name and its constraints. |
321+
| `Group` | Contains details about current Grouped column names. |
322322

323323
### Performing CRUD action with GraphQLAdaptor
324324

0 commit comments

Comments
 (0)