Hello,
I read a lot of thread and documentation about DataManager to load and sort (filtering etc) remote data to the grid component.
I create a CustomAdatptor, it works on load.
But when I want to send my sorting dto to my back end (in asp.net core 3.1), my dto is stilll empty. I tried to pass in the data attribut , in pvtData attribut but still nothing.
This is my code :
export class CustomAdaptor extends UrlAdaptor {
public processQuery(dm: DataManager, query: Query, hierarchyFilters?: Object[]): Object {
const original = super.processQuery.apply(this, arguments);
// My filtered dto let pagedFiltered: PagedFilteredListDto = {};
// sorting
if (query.queries.length > 0) {
query.queries.forEach((queryElement: QueryOptions) => {
pagedFiltered = {
sorting: {
orderType: queryElement.e.direction === 'Ascending' ? OrderTypes.Ascending : OrderTypes.Descending,
orderProperty: queryElement.e.fieldName,
},
};
});
}
const request = super.getQueryRequest(query);
return {
data: JSON.stringify(pagedFiltered),
url: `${original.url}`,
pvtData: original.pvtData,
type: 'GET',
contentType: 'application/json; charset=utf-8'
};
}
And this is my back end in ASP.NET Core 3.1 (I also tried with [FromRoute] )
[HttpGet, MapToApiVersion("1")]
[ProducesResponseType(typeof(PagedListResultBase<Journal>), StatusCodes.Status200OK)]
public async Task<ActionResult<PagedListResultBase<Journal>>> Get([FromRoute]GetJournalsQuery query)
Best regards,
Charlotte