Skip to content Skip to sidebar Skip to footer

Nested Json Data Minipulation For Ngx Datatable In Angualr -6 / Js

I am trying to create a ngx datatable that creates columns dynamically from nested arrays, which with some research is not possible - so to achieve my desired result, I must flatte

Solution 1:

You can use es6 destructuring for this, simply expose whatever properties you need and then "recompose" then into the object shape you want. For example:

return myEmployeeArray.map(employee => { 
const {earn } = employee
earn.map(field => field.abbreviation)
myDesiredObject = { fieldA: employee.abbreviation....fieldE:field.abbreviation} 
}

This would get you one of your nested fields

Post a Comment for "Nested Json Data Minipulation For Ngx Datatable In Angualr -6 / Js"