gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
696 stars 134 forks source link

Client cannot render response from Server - GridShared.Pagination.PagingType #414

Open puchalskipl opened 4 months ago

puchalskipl commented 4 months ago

Describe the bug Backend respond with items, e.g. { "items": [ { "id": "1" } ], "totals": { "sum": {}, "average": {}, "max": {}, "min": {}, "calculations": {} }, "pager": { "pagingType": "Pagination", "pageSize": 20, "currentPage": 1, "itemsCount": 2, "startIndex": 0, "virtualizedCount": 0, "enablePaging": false } }

Client cannot deserialized it, error message from browser console: The JSON value could not be converted to GridShared.Pagination.PagingType. Path: $.pager.pagingType | LineNumber: 0 | BytePositionInLine: 9562.

Desktop (please complete the following information):

gustavnavar commented 4 months ago

The back-end should return "pagingType": 1 instead of "pagingType": "Pagination".

The JSON serializer that you are using in the controller action serializes enums as string instead of number, that is the default behavior.

Are you using Newtonsoft or System.Text.Json?