Hello,
We are building a Vue3 website using Syncfusion grid. We've make a grid component wrapper with a custom data adaptor.
We have two views with the same parent that renders two grids (one per view). The problem is that when the second grid is created it seems to replace the data adaptor of the first grid, which is created in another view, another id, and its own instance of the data manager.
We've the theory that the Syncfusion grid are resolving only one data adaptor instance for both grids. But the grids in each view are differents, with differentId and with different data adapter classes instantiated in each view.
This is how the grid wrapper lo:
<GridComponent
ref="grid"
:id="gridId"
:columns="columns"
:dataSource="dataSource"
...
<script lang="ts">
import { GridComponent } from '@syncfusion/ej2-vue-grids';
...
The data adaptor looks like this:
createCustomDataManager: (service: IEditInlineServiceReturn<any>, filter: any = {}) => new DataManager({
headers: [{ Authorization: `Bearer ${getKeycloak()?.token}` }],
adaptor: new CustomDataAdaptor({
getData: async (option: AjaxOption) => {
try {
const data = JSON.parse(option.data!);
const request = flatRequest(data);
const externalFilters = getExternalFilters(filter);
request.filters.push(...externalFilters);
const response = await service.fetch(request);
option.onSuccess!(response.data, extend({}, option, { httpRequest: response.request }));
} catch (error) {
option.onFailure!((error as any).request);
}
},
...
This is an example of the grid component creation;
<GGrid
ref="grid"
:columns="headers"
:dataSource="dataSource"
:externalFilters="filter"
:editSettings="editSettings"
:allowSorting="false"
:allowPaging="false"
:service="service"
:allowFiltering="false"
:hideChildGridCols="true"
:actionComplete="gridActionCompleted"
/>
...
const service = new RelfiletypeconfigurationphaseGridService('relfiletypeconfigurationphase');
...
return {
dataSource: SyncfusionUtils.createCustomDataManager(service, props.filter),
...