JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › array in json
- This topic has 1 reply, 2 voices, and was last updated 3 years, 7 months ago by
admin.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
February 2, 2021 at 11:20 pm #101424
dusrkdldlr
Memberhello!
I want to use the value of an array in json.
It is returned as [object Object], how can I get this value?
This is example
:json{ "enabled": true, "tests": [ 1 ], "school": { "content": [ { "id": "1", "no": "1", "class": 1, "name": "ge1", "tags": [ ], "group": [ { "id": 1, "no": 1, "priority": 128, } ], "number_of_elements": 10, "first": true } }
get json
<div> <div>if(details.action === 'dataBind' ){</div> <div> fetch(<code>test.json</code>,{</div> <div> method: 'POST',</div> <div> body: paramData</div> <div> }).then(response => response.json())</div> <div> .then(data => {</div> <div> const result = data;</div> <div> console.log("this is result", result);</div> <div> resultCallbackFunction({</div> <div> dataSource: result.school.content,</div> <div> virtualDataSourceLength: result.school.total_elements</div> <div> });</div> <div> });//fetch</div> </div>
columns
<div> <div>,{label: priority, dataField: "groip", visible: false,template: function(formatObject){</div> <div> console.log("length?", formatObject.row.data.groupObject.length)</div> <div> var groupObject = formatObject.row.data.group;</div> <div> for (var key in groupObject){</div> <div> console.log("key: " + key + "value" +groupObject[key])</div> <div> } } }</div> </div>
log
length? 15 key: 0value[ key: 1valueo key: 2valueb key: 3valuej key: 4valuee key: 5valuec key: 6valuet key: 7value key: 8valueO key: 9valueb key: 10valuej key: 11valuee key: 12valuec key: 13valuet key: 14value]
I wan’t use group.priority. but This value is returned as [object Object].
February 3, 2021 at 7:44 am #101428admin
KeymasterHi,
Unfortunately, we do not understand what you are trying to achieve. The data binding options of our DataGrid component are demonstrated https://www.htmlelements.com/demos/ in the Data Binding and Server-side Model sections.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/ -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.