kpmck / cypress-ag-grid

Cypress plugin for interacting with ag grid
30 stars 17 forks source link

Duplicate column names causes only last columns' data to be returned #42

Open OVO-Josh opened 1 year ago

OVO-Josh commented 1 year ago

If I have a grid with say the columns [Requested, Settled, Requested, Settled] Only the data from the last two columns is returned.

So for | Requested | Settled | Requested | Settled | | 10 | 5 | 6 | 8 |

A call to getAgGridData() would return [{"Requested": 6, "Settled": 8}]

In most scenarios where this occurs I imagine the user will have some group headers to differentiate between the columns themselves - so I propose adding the group header names to the column names to get around this.

So for | Total Price | Total Volume | | Requested | Settled | Requested | Settled | | 10 | 5 | 6 | 8 |

We'd get [{"Total Price Requested": 10, "Total Price Settled": 5, "Total Volume Requested": 6, "Total Volume Settled": 8}]

I currently have a working fix for this locally - happy to put up a PR to add it if wanted?

kpmck commented 1 year ago

Hey @OVO-Josh ! So sorry for the delayed response. I will carve out time this week to take a look and will respond shortly.

If you have a working fix, please feel free to put up a PR if you’d like!

nealeu commented 5 days ago

Any progress on this? We've got the same problem to work around.

If this is proving too complex, perhaps a simple alternative or option for getAgGridData() to return the cells keyed by columnId instead of columnName.