+
+
+
+
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js b/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js
new file mode 100644
index 000000000..f1228bac4
--- /dev/null
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js
@@ -0,0 +1,59 @@
+System.config({
+ transpiler: "ts",
+ typescriptOptions: {
+ target: "es5",
+ module: "system",
+ moduleResolution: "node",
+ emitDecoratorMetadata: true,
+ experimentalDecorators: true,
+ "jsx": "react"
+ },
+ meta: {
+ 'typescript': {
+ "exports": "ts"
+ }
+ },
+ paths: {
+ "syncfusion:": "https://cdn.syncfusion.com/ej2/28.1.33/"
+ },
+ map: {
+ app: 'app',
+ ts: "https://unpkg.com/plugin-typescript@4.0.10/lib/plugin.js",
+ typescript: "https://unpkg.com/typescript@2.2.2/lib/typescript.js",
+ "@syncfusion/ej2-inputs": "syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js",
+ "@syncfusion/ej2-calendars": "syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js",
+ "@syncfusion/ej2-lists": "syncfusion:ej2-lists/dist/ej2-lists.umd.min.js",
+ "@syncfusion/ej2-base": "syncfusion:ej2-base/dist/ej2-base.umd.min.js",
+ "@syncfusion/ej2-grids": "syncfusion:ej2-grids/dist/ej2-grids.umd.min.js",
+ "@syncfusion/ej2-data": "syncfusion:ej2-data/dist/ej2-data.umd.min.js",
+ "@syncfusion/ej2-buttons": "syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js",
+ "@syncfusion/ej2-popups": "syncfusion:ej2-popups/dist/ej2-popups.umd.min.js",
+ "@syncfusion/ej2-navigations": "syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js",
+ "@syncfusion/ej2-pdf-export": "syncfusion:ej2-pdf-export/dist/ej2-pdf-export.umd.min.js",
+ "@syncfusion/ej2-compression": "syncfusion:ej2-compression/dist/ej2-compression.umd.min.js",
+ "@syncfusion/ej2-excel-export": "syncfusion:ej2-excel-export/dist/ej2-excel-export.umd.min.js",
+ "@syncfusion/ej2-file-utils": "syncfusion:ej2-file-utils/dist/ej2-file-utils.umd.min.js",
+ "@syncfusion/ej2-dropdowns": "syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js",
+ "@syncfusion/ej2-notifications":"syncfusion:ej2-notifications/dist/ej2-notifications.umd.min.js",
+ "@syncfusion/ej2-splitbuttons": "syncfusion:ej2-splitbuttons/dist/ej2-splitbuttons.umd.min.js",
+
+ "@syncfusion/ej2-react-base": "syncfusion:ej2-react-base/dist/ej2-react-base.umd.min.js",
+ "@syncfusion/ej2-react-grids": "syncfusion:ej2-react-grids/dist/ej2-react-grids.umd.min.js",
+ "@syncfusion/ej2-react-buttons": "syncfusion:ej2-react-buttons/dist/ej2-react-buttons.umd.min.js",
+ "@syncfusion/ej2-react-calendars": "syncfusion:ej2-react-calendars/dist/ej2-react-calendars.umd.min.js",
+ "@syncfusion/ej2-react-dropdowns": "syncfusion:ej2-react-dropdowns/dist/ej2-react-dropdowns.umd.min.js",
+ "@syncfusion/ej2-react-inputs": "syncfusion:ej2-react-inputs/dist/ej2-react-inputs.umd.min.js",
+"react-dom":"https://unpkg.com/react-dom@16.3.1/umd/react-dom.development.js",
+"react":"https://unpkg.com/react@16.3.1/umd/react.development.js",
+
+ },
+ packages: {
+ 'app': { main: 'index', defaultExtension: 'tsx' },
+ }
+
+});
+
+System.import('app');
+
+
+
diff --git a/ej2-react/grid/data-binding/data-binding.md b/ej2-react/grid/data-binding/data-binding.md
index d2ab9d361..86868fdae 100644
--- a/ej2-react/grid/data-binding/data-binding.md
+++ b/ej2-react/grid/data-binding/data-binding.md
@@ -276,4 +276,27 @@ The following code demonstrates, how to use the `changeDataSource` method to bin
{% previewsample "page.domainurl/code-snippet/grid/data-datasource" %}
>* The Grid state persistence feature does not support the `changeDataSource` method.
->* In this document, the above sample uses the local data for `changeDataSource` method. For those using a remote data source, refer to the [FlexibleData](https://ej2.syncfusion.com/react/demos/#/bootstrap5/grid/flexible-data) resource.
\ No newline at end of file
+>* In this document, the above sample uses the local data for `changeDataSource` method. For those using a remote data source, refer to the [FlexibleData](https://ej2.syncfusion.com/react/demos/#/bootstrap5/grid/flexible-data) resource.
+
+## How to set custom headers using a custom adaptor in Syncfusion Grid
+
+Custom headers allow you to send extra information along with your HTTP requests. This information can include authentication tokens, API keys, or any other data required by the server to process the request correctly. By adding custom headers, you can enhance the security and functionality of your application's data communication process.
+
+This section explains how to integrate custom headers into Syncfusion Grid using the `beforeSend` method of the `WebApiAdaptor`.
+
+{% tabs %}
+{% highlight js tabtitle="App.jsx" %}
+{% include code-snippet/grid/custom-headers-cs1/app/App.jsx %}
+{% endhighlight %}
+{% highlight ts tabtitle="App.tsx" %}
+{% include code-snippet/grid/custom-headers-cs1/app/App.tsx %}
+{% endhighlight %}
+{% highlight js tabtitle="CustomAdaptor.jsx" %}
+{% include code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx %}
+{% endhighlight %}
+{% highlight ts tabtitle="CustomAdaptor.tsx" %}
+{% include code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx %}
+{% endhighlight %}
+{% endtabs %}
+
+{% previewsample "page.domainurl/code-snippet/grid/custom-headers-cs1" %}
\ No newline at end of file
From 4b64f42a156c54d75f05b3ad2e112cfd65c2d6f5 Mon Sep 17 00:00:00 2001
From: vikramsundarajan <129823420+vikramsundarajan@users.noreply.github.com>
Date: Fri, 7 Mar 2025 19:12:59 +0530
Subject: [PATCH 2/3] Modified the content and removed the extra spaces in code
snippets
---
.../grid/custom-headers-cs1/app/App.jsx | 12 +++----
.../grid/custom-headers-cs1/app/App.tsx | 29 ++++++++---------
.../custom-headers-cs1/app/CustomAdaptor.jsx | 2 +-
.../custom-headers-cs1/app/CustomAdaptor.tsx | 2 +-
.../grid/custom-headers-cs1/app/index.tsx | 1 -
.../custom-headers-cs1/app/orderModel.tsx | 1 -
.../grid/custom-headers-cs1/index.css | 1 -
.../grid/custom-headers-cs1/index.html | 32 +++----------------
.../custom-headers-cs1/systemjs.config.js | 8 ++---
ej2-react/grid/data-binding/data-binding.md | 10 ++++--
10 files changed, 35 insertions(+), 63 deletions(-)
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
index 6e0364c16..075879c79 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
@@ -9,12 +9,12 @@ function App() {
});
return
-
-
-
-
-
-
+
+
+
+
+
+
};
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
index 4eadcef5e..7a6ffb1bd 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
@@ -2,21 +2,20 @@ import { ColumnDirective, ColumnsDirective, Grid, GridComponent, Page, Inject }
import * as React from 'react';
import { DataManager, WebApiAdaptor } from '@syncfusion/ej2-data';
import { CustomAdaptor } from './CustomAdaptor';
-
function App() {
- const data = new DataManager({
- adaptor: new CustomAdaptor(),
- url: 'https://services.syncfusion.com/react/production/api/Orders',
- });
- return
-
-
-
-
-
-
-
-
-
+ const data = new DataManager({
+ adaptor: new CustomAdaptor(),
+ url: 'https://services.syncfusion.com/react/production/api/Orders',
+ });
+ return
+
+
+
+
+
+
+
+
+
};
export default App;
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
index b7bb9605a..9848350b4 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
@@ -1,7 +1,7 @@
import { WebApiAdaptor } from '@syncfusion/ej2-data';
export class CustomAdaptor extends WebApiAdaptor {
beforeSend(dm, request, settings) {
- request.headers.set('Syncfusion', true);
+ request.headers.set('Syncfusion', true); // Assign custom headers here.
super.beforeSend(dm, request, settings);
}
}
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
index 91ec85cb8..0e0bebc69 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
@@ -1,7 +1,7 @@
import { WebApiAdaptor,DataManager,Fetch } from '@syncfusion/ej2-data';
export class CustomAdaptor extends WebApiAdaptor {
beforeSend(dm: DataManager, request: Request, settings: Fetch) {
- request.headers.set('Syncfusion', 'true');
+ request.headers.set('Syncfusion', 'true'); // Assign custom headers here.
super.beforeSend(dm, request, settings);
}
}
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/index.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/index.tsx
index 80b1b6ab0..9cf56b6c6 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/index.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/index.tsx
@@ -1,5 +1,4 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import App from './App';
-
ReactDOM.render(, document.getElementById('root'));
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/orderModel.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/orderModel.tsx
index 49d726321..4989105bc 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/orderModel.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/orderModel.tsx
@@ -1,4 +1,3 @@
-
export interface IOrderModel {
OrderID?: number;
CustomerID?: string;
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/index.css b/ej2-react/code-snippet/grid/custom-headers-cs1/index.css
index e2de99fc9..7b66b92a9 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/index.css
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/index.css
@@ -2,7 +2,6 @@
background-color: #f48fb1 !important;/* csslint allow: important */
color: white;
}
-
.e-grid .custom {
background-color: #fce4ec;
color: white;
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/index.html b/ej2-react/code-snippet/grid/custom-headers-cs1/index.html
index 0b9ebb656..74e9fe710 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/index.html
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/index.html
@@ -1,6 +1,5 @@
-
Syncfusion React Grid
@@ -21,7 +20,7 @@
-
-
-
-
Loading....
-
-
+
+
Loading....
+
-
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js b/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js
index f1228bac4..01b41f5e6 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/systemjs.config.js
@@ -36,23 +36,19 @@ System.config({
"@syncfusion/ej2-dropdowns": "syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js",
"@syncfusion/ej2-notifications":"syncfusion:ej2-notifications/dist/ej2-notifications.umd.min.js",
"@syncfusion/ej2-splitbuttons": "syncfusion:ej2-splitbuttons/dist/ej2-splitbuttons.umd.min.js",
-
"@syncfusion/ej2-react-base": "syncfusion:ej2-react-base/dist/ej2-react-base.umd.min.js",
"@syncfusion/ej2-react-grids": "syncfusion:ej2-react-grids/dist/ej2-react-grids.umd.min.js",
"@syncfusion/ej2-react-buttons": "syncfusion:ej2-react-buttons/dist/ej2-react-buttons.umd.min.js",
"@syncfusion/ej2-react-calendars": "syncfusion:ej2-react-calendars/dist/ej2-react-calendars.umd.min.js",
"@syncfusion/ej2-react-dropdowns": "syncfusion:ej2-react-dropdowns/dist/ej2-react-dropdowns.umd.min.js",
"@syncfusion/ej2-react-inputs": "syncfusion:ej2-react-inputs/dist/ej2-react-inputs.umd.min.js",
-"react-dom":"https://unpkg.com/react-dom@16.3.1/umd/react-dom.development.js",
-"react":"https://unpkg.com/react@16.3.1/umd/react.development.js",
-
+ "react-dom":"https://unpkg.com/react-dom@16.3.1/umd/react-dom.development.js",
+ "react":"https://unpkg.com/react@16.3.1/umd/react.development.js",
},
packages: {
'app': { main: 'index', defaultExtension: 'tsx' },
}
-
});
-
System.import('app');
diff --git a/ej2-react/grid/data-binding/data-binding.md b/ej2-react/grid/data-binding/data-binding.md
index 86868fdae..28149b250 100644
--- a/ej2-react/grid/data-binding/data-binding.md
+++ b/ej2-react/grid/data-binding/data-binding.md
@@ -278,11 +278,15 @@ The following code demonstrates, how to use the `changeDataSource` method to bin
>* The Grid state persistence feature does not support the `changeDataSource` method.
>* In this document, the above sample uses the local data for `changeDataSource` method. For those using a remote data source, refer to the [FlexibleData](https://ej2.syncfusion.com/react/demos/#/bootstrap5/grid/flexible-data) resource.
-## How to set custom headers using a custom adaptor in Syncfusion Grid
+## How to set custom headers using a custom adaptor in Syncfusion React Grid
-Custom headers allow you to send extra information along with your HTTP requests. This information can include authentication tokens, API keys, or any other data required by the server to process the request correctly. By adding custom headers, you can enhance the security and functionality of your application's data communication process.
+Custom headers in HTTP requests are used to send additional information such as authentication tokens, API keys, or metadata required by the server. These headers improve security and enable better control over data communication. In the Syncfusion React Grid, custom headers can be added when making API requests, ensuring that each request carries the necessary information for server-side validation and processing.
-This section explains how to integrate custom headers into Syncfusion Grid using the `beforeSend` method of the `WebApiAdaptor`.
+This method is particularly useful when integrating the Grid with authenticated APIs, where requests must include authorization tokens or other security credentials to ensure secure access.
+
+To achieve this, the `WebApiAdaptor` can be extended to create the custom adaptor. The `beforeSend` method in the custom adaptor allows modifying request headers before sending them to the server. This ensures that every request from the Grid includes the required headers.
+
+The following example demonstrates how to set custom headers using the custom adaptor in Syncfusion React Grid.
{% tabs %}
{% highlight js tabtitle="App.jsx" %}
From eb9c71687c80b12cc5101ab6fc730f6f36e6c616 Mon Sep 17 00:00:00 2001
From: vikramsundarajan <129823420+vikramsundarajan@users.noreply.github.com>
Date: Fri, 21 Mar 2025 17:50:55 +0530
Subject: [PATCH 3/3] 858871: changed the code snippets
---
.../grid/custom-headers-cs1/app/App.jsx | 22 ++++++++++---------
.../grid/custom-headers-cs1/app/App.tsx | 8 ++++---
.../custom-headers-cs1/app/CustomAdaptor.jsx | 7 +++---
.../custom-headers-cs1/app/CustomAdaptor.tsx | 9 ++++----
ej2-react/grid/data-binding/data-binding.md | 3 +++
5 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
index 075879c79..109820742 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.jsx
@@ -7,15 +7,17 @@ function App() {
adaptor: new CustomAdaptor(),
url: 'https://services.syncfusion.com/react/production/api/Orders',
});
- return
-
-
-
-
-
-
-
-
-
+ return
+
+
+
+
+
+
+
+
+
+
+
};
export default App;
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
index 7a6ffb1bd..109820742 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/App.tsx
@@ -8,11 +8,13 @@ function App() {
url: 'https://services.syncfusion.com/react/production/api/Orders',
});
return
-
+
+
-
-
+
+
+
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
index 9848350b4..7fc15c7d5 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx
@@ -1,7 +1,8 @@
import { WebApiAdaptor } from '@syncfusion/ej2-data';
export class CustomAdaptor extends WebApiAdaptor {
- beforeSend(dm, request, settings) {
- request.headers.set('Syncfusion', true); // Assign custom headers here.
- super.beforeSend(dm, request, settings);
+ beforeSend(args, xhr, settings) {
+ xhr.withCredentials = true;
+ super.beforeSend(args, xhr, settings);
+ xhr.headers.set('Syncfusion', true); // Assign custom headers here.
}
}
\ No newline at end of file
diff --git a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
index 0e0bebc69..7fe15a29f 100644
--- a/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
+++ b/ej2-react/code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx
@@ -1,7 +1,8 @@
-import { WebApiAdaptor,DataManager,Fetch } from '@syncfusion/ej2-data';
+import { WebApiAdaptor } from '@syncfusion/ej2-data';
export class CustomAdaptor extends WebApiAdaptor {
- beforeSend(dm: DataManager, request: Request, settings: Fetch) {
- request.headers.set('Syncfusion', 'true'); // Assign custom headers here.
- super.beforeSend(dm, request, settings);
+ beforeSend(args:any, xhr:any, settings:any) {
+ xhr.withCredentials = true;
+ super.beforeSend(args, xhr, settings);
+ xhr.headers.set('Syncfusion', true); // Assign custom headers here.
}
}
\ No newline at end of file
diff --git a/ej2-react/grid/data-binding/data-binding.md b/ej2-react/grid/data-binding/data-binding.md
index 28149b250..7391e14eb 100644
--- a/ej2-react/grid/data-binding/data-binding.md
+++ b/ej2-react/grid/data-binding/data-binding.md
@@ -292,12 +292,15 @@ The following example demonstrates how to set custom headers using the custom ad
{% highlight js tabtitle="App.jsx" %}
{% include code-snippet/grid/custom-headers-cs1/app/App.jsx %}
{% endhighlight %}
+
{% highlight ts tabtitle="App.tsx" %}
{% include code-snippet/grid/custom-headers-cs1/app/App.tsx %}
{% endhighlight %}
+
{% highlight js tabtitle="CustomAdaptor.jsx" %}
{% include code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.jsx %}
{% endhighlight %}
+
{% highlight ts tabtitle="CustomAdaptor.tsx" %}
{% include code-snippet/grid/custom-headers-cs1/app/CustomAdaptor.tsx %}
{% endhighlight %}