How to display data from AxiosHttp in AgGridAlpine #466
-
Hello, First of all let me thank all the devs for this excellent product and beautiful new way to build web apps. I read about the project in Hacker News and trying it out. My objective is to fetch data from I have created a request and its getting called from The output from the HTTP request is as follows: {
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
} and my table definition is as follows: - id: table_card
type: Card
properties:
title: List of users in json placeholder API
blocks:
- id: table
type: AgGridAlpine
properties:
theme: basic
rowData:
_request: get_users
defaultColDef:
sortable: true
resizable: true
filter: true
columnDefs:
- headerName: Name
field: name
width: 350
- headerName: Username
field: username
width: 100 request is requests:
- id: get_users
type: AxiosHttp
connectionId: jsonplaceholder_api
properties:
url: http://jsonplaceholder.typicode.com/users/1 Full project is available at https://github.com/xuoguoto/testui Thanks for your help! Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi Thanks for trying things out, and for being the first to ask a question here! The AgGrid tables expect an array of data items, one for each row in the table, while your request returns an object. This should render - id: table_card
type: Card
properties:
title: List of users in json placeholder API
blocks:
- id: table
type: AgGridAlpine
properties:
theme: basic
rowData:
- _request: get_users # Note the "-" (this creates a 1 element array)
defaultColDef:
sortable: true
resizable: true
filter: true
columnDefs:
- headerName: Name
field: name
width: 350
- headerName: Username
field: username
width: 100 But this will only have a single row. The Descriptions block might be a better fit. (I see it isn't rendering properly in the docs, it should look like a table when |
Beta Was this translation helpful? Give feedback.
-
I did try to work with This is how my - id: user_list
type: Descriptions
properties:
column: 2
title: List of users in json placeholder API
items:
- _request: get_users Obviously its not working :) Even though my |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! Its working now. On to reading more docs and exploration! |
Beta Was this translation helpful? Give feedback.
Thanks a lot! Its working now. On to reading more docs and exploration!