-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomAdaptor.jsx
More file actions
26 lines (23 loc) · 878 Bytes
/
CustomAdaptor.jsx
File metadata and controls
26 lines (23 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { setValue } from '@syncfusion/ej2-base';
import { ODataV4Adaptor, } from '@syncfusion/ej2-data';
export class CustomAdaptor extends ODataV4Adaptor {
processResponse() {
let i = 0;
const original = super.processResponse.apply(this, arguments);
/* Adding serial number */
if (original.result) {
original.result.forEach((item) => setValue('SNo', ++i, item));
}
return original;
}
processQuery(dm, query) {
dm.dataSource.url = 'https://localhost:7284/odata/orders';
query.addParams('Syncfusion in React Grid', 'true');
const result = super.processQuery.apply(this, arguments);
return result;
}
beforeSend(dm, request, settings) {
request.headers.set('Authorization', `Bearer${(window).token}`);
super.beforeSend(dm, request, settings);
}
}