Value of current element in objects
Value of current element in objects
stockmaj
Posts: 2Questions: 0Answers: 0
If I have data that looks like this
[code]
mydata:{
Adam:{
grade: 1,
gender: m
},
Betty:{
grade: 3,
gender: f
}
[/code]
and Columns "Name", "grade", "gender"
how do I access the name (Adam, Betty) as well as the data within. I can't use 0.grade, 1.grade, etc, I want the data for each element of my data, not for a specific element of mydata? The only way I've been able to make this work so far is by pre processing the objects into new objects that have all the data in a flattened structure.
I'd like to be able to do something like this:
[code]
data: mydata
columns: [ {data: ?}, {data: ?.grade}, {data: ?.gender} ]
[/code]
[code]
mydata:{
Adam:{
grade: 1,
gender: m
},
Betty:{
grade: 3,
gender: f
}
[/code]
and Columns "Name", "grade", "gender"
how do I access the name (Adam, Betty) as well as the data within. I can't use 0.grade, 1.grade, etc, I want the data for each element of my data, not for a specific element of mydata? The only way I've been able to make this work so far is by pre processing the objects into new objects that have all the data in a flattened structure.
I'd like to be able to do something like this:
[code]
data: mydata
columns: [ {data: ?}, {data: ?.grade}, {data: ?.gender} ]
[/code]
This discussion has been closed.
Replies
Allan