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) {
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(),
});
}
}