You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is, after pressing the button, the "focus" in the table is lost and pressing Ctrl+C does nothing.
The only way I could get it to work was by dispatching mouse events to cells within the table, to simulate the user dragging across the entire table. This prevents the click on the "Select All" button from removing the Ctrl+C listener:
This is a no-good, horrible, very bad hack, so if anyone knows the correct way to do this I would be very glad to see it. In any case, thanks for this great library!
The text was updated successfully, but these errors were encountered:
ericman314
changed the title
How to select all cells, then copy?
How to (programmatically) select all cells, then copy?
Sep 28, 2021
I will ask and answer my own question in the hopes it can be of use to someone, but I'm really hoping someone will share the right way to do this.
I have a ReactDataGrid with a controlled selection. I also have a custom copy handler, but I don't think that matters in this case.
I also have a "Select All" button outside of my ReactDataGrid, whose
onClick
handler calls this function to set the selection to the entire range:The problem is, after pressing the button, the "focus" in the table is lost and pressing Ctrl+C does nothing.
The only way I could get it to work was by dispatching mouse events to cells within the table, to simulate the user dragging across the entire table. This prevents the click on the "Select All" button from removing the Ctrl+C listener:
This is a no-good, horrible, very bad hack, so if anyone knows the correct way to do this I would be very glad to see it. In any case, thanks for this great library!
The text was updated successfully, but these errors were encountered: