Hi, is posible change "Items" name? or better question: is for me this approach?
This is my result json:
my web:
Hi Sergio Ayala,
Based on your query we would like to clarify that ,we have provided
support for various types adaptor which will be used to fetch data from
different API server end and bind it to Grid. While using SfDataManager and
Adaptor, only current page records will be fetched from server and paging
operations will be handed in on demand concept. Please find the list of
adaptors from below
Reference: Adaptors
in Blazor DataManager Component | Syncfusion
So, if you have a JSON object with properties result and count, we suggest
using the URL
Adaptor.
If this still doesn’t meet your requirements, could you please confirm? Are you
asking if it is possible to change the name of the 'Items' key in the JSON
response? If so, could you clarify where and how you would like this change to
be implemented?
Regards,
Prathap Senthil
yes, the approach for me is "Url adaptor
Ok, I understand that the adapter I should use is "WebApiAdaptor" but:
1- does it matter if my json says "results" instead of "result"?
2- how do I bind each column? this is my json:
<GridColumn Field="@nameof(Instruction.Id)" HeaderText="Order ID" IsPrimaryKey="true"></GridColumn>
my web show the header, but no columns:
No, when using the UrlAdaptor, you need to follow the standard format that UrlAdaptor expects. The response should be a JSON object with the properties result and count, which represent the collection of entities and the total number of records, respectively. The sample response object should look like this:
|
{ "result": [{..}, {..}, {..}, ...], "count": 67 }
|
Similarly, the WebApiAdaptor expects a JSON response from the server. The response object should contain the properties Items and Count, where Items is the collection of entities and Count is the total count of the entities. The sample response object should look like this:
|
{ "Items": [{..}, {..}, {..}, ...], "Count": 830 }
|
We suggest achieving your requirement using one of the adapters listed above
with a standard format URL. If this does not meet your needs or if you have
customized API endpoints, we recommend using the Custom Adapter with HttpClient
to fulfill your requirements. We have already discussed this in the forum
thread linked below, please refer to it for further information.