useDataGrid api response
useDataGrid
Hello!
I am trying to implement the useDataGrid to my CompanyList page. Although there is no error occurred, the data is not showing.
I am using Laravel API so the response is usually like this:
------------------------------------------------
{
"data":[
{
"id":"28df5301-2f4e-4774-8ce5-ca291073ce8f",
"name":"Ruecker-Larson",
"category":"Small Business Enterprice",
"industry":"Casting Machine Operator",
"description":"Dolores sit qui delectus velit sunt eos voluptas.",
"logo":null,
"website":null,
"is_active":"ACTIVE",
"created_by":"SYSTEMBOT",
"created_at":"3 weeks ago",
"updated_by":"SYSTEMBOT",
"updated_at":"3 weeks ago"
}
],
"total":2502
}
------------------------------------------------
In your example page, it shows like this
[
{
"id": 1,
"title": "A aspernatur rerum molestiae.",
"content": "Natus molestias incidunt voluptatibus. Libero delectus facilis...",
"status": "published"
},
{
"id": 2,
"title": "A molestiae vel voluptatem enim.",
"content": "Voluptas consequatur quia beatae. Ipsa est qui culpa deleniti...",
"status": "draft"
}
]
------------------------------------------------
Is there a way I can control or map my API response?
Thank you.
2 Replies
Hey @Sigmund 👋,
Thank you for interest in refine!
You can override getList function of your dataProvider ⚡️
https://refine.dev/docs/faq/#how-i-can-override-specific-function-of-data-providers
Example: https://github.com/refinedev/real-world-example/blob/main/src/dataProvider.ts#L40
like-goldOP•3y ago
Thank you @Omer . Override getList function solved my problem. Thank you.