Open buck999 opened 7 years ago
Generic table is meant to be used with flat objects so the easiest option would probably be flatten the objects or to write a simple map function to create new row objects containing the properties you want to display in the table, e. g.
data.map(row => {
return {
UUID: row.UUID,
nome: row.data.nome
...
}
})
Another option you could try, although I'm not sure it works as I haven't tried it myself, would be to use the value function of gtFields to tell the table where to fetch the "real" data. e. g.
settings: [{
objectKey: 'nome'
}, {
objectKey: 'data',
visible: false
}]
fields: [{
name: 'Nome',
objectKey: 'nome',
value:(row)=>{return row.data.nome}
}, {
name: '',
objectKey: 'data'
}]
please note that you still need to specify all the columns you want to use under settings and fields (you could write a function to add them dynamically too).
Feel free to try above and let me know if it works for you. Haven't really thought to much about nested data objects but if this is something more people would like to use I might consider adding it to make it even easier.
the value seems to work, but yeah we'll love support for nested json
like this.