Using AG Grid we populate column defs array with column names returned by back end
Consider the array below , populated with data returned by the back end :
columnDefs: [
{ headerName: 'column_1', field: 'column_value_1' },
{ headerName: 'column_2', field: 'column_value_2' },
{ headerName: 'column_3', field: 'column_value_3' }
]
What TypeScript syntax could be used to implement the pseudo snippet below ? :
given rowData = []
given rowOfValues = [ row_value_1 , row_value_2 , row_value_3 ] // From Back End
given rowOfColumnNames= [ column_value_1 , column_value_2 , column_value_3 ] // From Back End
for index = 0 ; while index < rowOfValues.size ; index++
add to rowData ( rowOfColumnNames[index] : rowOfValues[index] )
return rowData
As per AG_Grid specification , the resulting rowData array wouuld be as follows :
rowData = [ {
column_value_1: 'row_value_1', column_value_2 'row_value_2', column_value_3: row_value_3 }
];