- Home
- Forum
- ASP.NET Core - EJ 2
- Repeated request with Custom DataManager
Repeated request with Custom DataManager
Good morning we are using the adaptation of the Data Manager Request through Js and I have observed that the request is made twice to the server and I do not see the error where it may be, I share my code.
<ejs-grid id="Grid-Lineas"
toolbarClick="toolbarClick"
toolbar="@(new List<string>() { "Add", "Edit", "Delete"})"
enableHover="true"
created="created"
actionFailure="actionFailure"
actionBegin="actionBegin"
actionComplete="actionComplete">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"
mode="Dialog" template='#dialogtemplate' showDeleteConfirmDialog="true">
</e-grid-editSettings>
My custom adapter :
My custom adapter :
class CustomAdaptor extends ej.data.UrlAdaptor {
processResponse(data, ds, query, xhr, request, changes) {
if (!ej.base.isNullOrUndefined(data.message)) {
ej2Grid_showMessage(data.message);
}
if (!ej.base.isNullOrUndefined(data.data))
return data.data;
else
return data;
}
beforeSend(args, xhr) {
xhr.withCredentials = true;
super.beforeSend(args, xhr);
}
}
SIGN IN To post a reply.
3 Replies
MS
Manivel Sellamuthu
Syncfusion Team
June 1, 2020 10:35 AM UTC
Hi diego,
Greetings from Syncfusion support.
Before proceeding your query, could you please confirm that while request made twice while performing crud actions or grid actions.
If you are getting repeated requests while Performing crud actions, that is the default behavior of the Grid.
- One request will be made for storing the data(Updating the data to server for Update or Delete or Insert)
- Another request is for getting the current view data according the page settings.
So to validate further could you please share the complete Grid code including code for Dialog template and network tab Screenshot which will be helpful for us to validate further about issue.
Regards,
Manivel
DI
diego
June 2, 2020 06:41 AM UTC
Good morning the request that is made is a Get To obtain the data of the Grid.
<ejs-grid id="Grid"
toolbarClick="toolbarClick"
toolbar="@(acciones)"
allowPaging="true"
allowSorting="true"
allowResizing="true"
showColumnMenu="true"
allowFiltering="true"
allowExcelExport="true"
allowPdfExport="true"
enableHover="true"
created="created"
actionBegin="actionBegin"
actionFailure="actionFailure"
actionComplete="actionComplete"
recordDoubleClick="doubleClick_edit"
>
function js:
function created(args) {
function js:
function created(args) {
ej2Grid_created(args, "Producto", "Producto", "Grid");
}
function ej2Grid_created(args, controlador, entidad, nameGrid, where) {
class CustomAdaptor extends ej.data.UrlAdaptor {
processResponse(data, ds, query, xhr, request, changes) {
if (!ej.base.isNullOrUndefined(data.message)) {
ej2Grid_showMessage(data.message);
}
if (!ej.base.isNullOrUndefined(data.data))
return data.data;
else
return data;
}
beforeSend(args, xhr) {
xhr.withCredentials = true;
super.beforeSend(args, xhr);
}
}
var grid = document.querySelector('#' + nameGrid).ej2_instances[0];
if (typeof (where) === 'undefined') {
grid.dataSource = new ej.data.DataManager({
url: "/" + controlador + "/Get" + entidad,
insertUrl: "/" + controlador + "/Insert" + entidad,
updateUrl: "/" + controlador + "/Update" + entidad,
removeUrl: "/" + controlador + "/Delete" + entidad,
adaptor: new CustomAdaptor(),
});
} else {
grid.dataSource = new ej.data.DataManager({
url: "/" + controlador + "/Get" + entidad + "?" + where,
insertUrl: "/" + controlador + "/Insert" + entidad,
updateUrl: "/" + controlador + "/Update" + entidad,
removeUrl: "/" + controlador + "/Delete" + entidad,
adaptor: new CustomAdaptor(),
});
}
}
MS
Manivel Sellamuthu
Syncfusion Team
June 4, 2020 06:28 AM UTC
Hi diego,
Thanks for your update.
We have tried the same shared code example at our end. But it was working fine at our end. You can check the below screenshot, while the page is loading only one request is made to Server side to get the data for first page records. Please find the below tried example for your reference.
Screenshot:
Could you please share the below details, which will be helpful for us to validate further about issue.
- Share the Syncfusion packages and Scripts version
- Share the video demonstration or Screenshot of the issue
- If possible try to replicate the issue in the given sample or share a simple issue replicated sample
Regards,
Manivel
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DI diego
- May 29, 2020 07:45 AM UTC
- Jun 4, 2020 06:28 AM UTC