我有一个数组,我想对其进行迭代并将该数组推到新创建的json对象中。
this is my json with key value pair
'fileContent': {
'content': [{
'effectiveDate': '4/23/2019',
'supplierId': 'ABD',
'sailCode': 'CM0123',
'Departure Date': '4/23/2019',
'reportId': 7960
},
{
'effectiveDate': '4/23/2019',
'supplierId': 'ABD',
'sailCode': 'CM0123',
'Departure Date': '4/23/2019',
'reportId': 7960
}
],'fileContent': {
'content': [{
'effectiveDate': '4/23/2019',
'supplierId': 'ABD',
'sailCode': 'CM0123',
'Departure Date': '4/23/2019',
'reportId': 7960
},
{
'effectiveDate': '4/23/2019',
'supplierId': 'ABD',
'sailCode': 'CM0123',
'Departure Date': '4/23/2019',
'reportId': 7960
}
],
Requirement is i have to show the key as header and value as their property in each row. i am using ag-grid.
(1): i am able to get the content and key also
this.assiengedValue = fileContent.content;
const types = Object.keys(this.assiengedValue[0]);
(2): i want to iterate and put that into dynamic array like this.
uiHeader[{'headerName':'effectiveDate','field': 'effectiveDate',
{'headerName':'SupplierId','filed':'supplierId'},
{'headerName':'SailCode','field':'sailCode'}
]
预计:提交的文件应位于具有headerName和field的数组内,以便我可以在columnDefs中进行设置。