Sample odata4 service?

I am trying to populate an sfgrid and am using a sample odata / webapi project from here.   First I had an issue with the format of the requests (parameters) not knowing what inlinecount is so I changed the adapter to the "ODataV4Adaptor" and that seemed to work and that sample project now returns data.   The problem is the data comes back looking like this and my sfgrid is not populating I am assuming because this is not a proper response.   I cant figure out how to get the response formatted properly though.    I saw post here that mentioned removing the [ApiController] decoration but that did not seem to help.

So, I am trying to figure out either how to return data in the proper format for syncfusion / odata4, or how to change sfgrid/adapter to send/receive in the matching format.   Any help is apprecidate


[
  {
    "Id": 1,
    "ToDoName": "test23"
  },
  {
    "Id": 2,
    "ToDoName": "test"
  },
  {
    "Id": 4,
    "ToDoName": "fds"
  },
  {
    "Id": 5,
    "ToDoName": "fdsfsdfdsf"
  },
  {
    "Id": 6,
    "ToDoName": "fdsfds"
  },
  {
    "Id": 7,
    "ToDoName": "fdsf"
  },
  {
    "Id": 8,
    "ToDoName": "fdsfsdf"
  },
  {
    "Id": 9,
    "ToDoName": "fdsfdsf"
  },
  {
    "Id": 10,
    "ToDoName": "fdsfdsf"
  },
  {
    "Id": 11,
    "ToDoName": "fdsfdsf"
  },
  {
    "Id": 12,
    "ToDoName": "fdsf"
  },
  {
    "Id": 13,
    "ToDoName": "xxx"
  },
  {
    "Id": 14,
    "ToDoName": "fdsfsd"
  },
  {
    "Id": 15,
    "ToDoName": "fdsf"
  },
  {
    "Id": 16,
    "ToDoName": "dsds"
  },
  {
    "Id": 17,
    "ToDoName": "test3"
  },
  {
    "Id": 18,
    "ToDoName": "test3"
  },
  {
    "Id": 19,
    "ToDoName": "xxx"
  },
  {
    "Id": 20,
    "ToDoName": "xxx"
  },
  {
    "Id": 21,
    "ToDoName": "test"
  },
  {
    "Id": 22,
    "ToDoName": "fdsfs"
  },
  {
    "Id": 23,
    "ToDoName": "fdsf"
  },
  {
    "Id": 24,
    "ToDoName": "fdsf"
  },
  {
    "Id": 25,
    "ToDoName": "fdsf"
  }
]

1 Reply

PS Prathap Senthil Syncfusion Team August 22, 2023 12:54 PM UTC

Hi Scott 


Query:” Sample odata4 service?”


Based on your description, the issue appears to be related to formatting the response data for the grid when using OData4. We recommend referring to the provided simple sample and documentation below for your reference.

Reference:
https://blazor.syncfusion.com/documentation/data/adaptors#odatav4-adaptor

Note: After connecting the database we need to copy the path of the database and change the connection string with the copied path in OrdersDetailsContext.cs and appsettings.json  file based on the NORTHWIND.MDF file in APP_Data folder.


Regards,
Prathap S


Attachment: ODataCRUDServerApp_54a7a127.zip

Loader.
Up arrow icon