I have received a data response that needs to be formatted as expected. I need to format an array of objects based on the rowIndex, and I am open to any better solutions.
Input :
productdata:[ { rowIndex:1 , columnKey:'productName'},
{ rowIndex:1 , columnKey:'productID'},
{ rowIndex:1 , columnKey:'productDate'},
{ rowIndex:2 , columnKey:'productName'},
{ rowIndex:2 , columnKey:'productID'},
{ rowIndex:2 , columnKey:'productDate'},
],
Expected Output:
[ { rowIndex:1 , columnKey:'productName'},
{ rowIndex:1 , columnKey:'productID'},
{ rowIndex:1 , columnKey:'productDate'}],
[{ rowIndex:2 , columnKey:'productName'},
{ rowIndex:2 , columnKey:'productID'},
{ rowIndex:2 , columnKey:'productDate'}],etc