Hello,
I started with Syncfusion Blazor just now, so sorry if my question is trivial. :)
I have a Web API and I would like bind it to DaraGrid in blazor webassembly app with Grouping and Filtering.
I attach my controller code and the grid definition in a zip file.
My problems:
1. My method has a parameter:
[FromQuery] DataManagerRequest dataManagerRequest
but the model binder cannot parse any request from the client to this object.
2. The response not contains the "Items" property, therefore the grid is empty (when I create a temporaly object with Items and Count property then the response format is ok, but this not contains any extra functions like filter). So my question: why the DataResult object not has an "Items" method, or how will work in this case? How need I set the DataResult object to make the grid working?
3. There are any built-in way for server-side filtering? I need develop all filter types manually on every controller?
Thank you for help!
BR, László
|
[HttpGet]
public object Get()
{
...
var queryString = Request.Query; //Based on this request query, handle the data related actions.
...
}
|
Hi,
Thanks for the documentation (unfortunatelly it not contains the filtering and grouping parts but is very useful!)
I see an example about process the GET request manually, but I think this is a cumbersome solution.
So I change the method to HttpPost and it seems the filter working, but the grouping not now. I will continue to understand this part too...
[HttpPost]
[Route("readall")]
public async Task<Object> ReadAsync([FromBody] DataManagerRequest dataManagerRequest)
{
....
if (dataManagerRequest.Where?.Count > 0) // perform searching
{
GridData = DataOperations.PerformFiltering(GridData, dataManagerRequest.Where, "and");
}
....
return dataManagerRequest.RequiresCounts ? new DataResult() { Result = GridData, Count = count, Aggregates = aggregates } :(object)GridData;
}
And I need modify the client part like this:
<SfDataManager Url="api/szallito/readall" Adaptor="Adaptors.UrlAdaptor"></SfDataManager>
Now the data loading to grid, the filter and paging seems working, the grouping not now, but I will continue to work on it.
To avoid unnecessary work :) I would like ask, that this conception is good?
Thank you!