Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy to clipboard with headers #39

Closed
achillis2 opened this issue Nov 2, 2022 · 1 comment
Closed

copy to clipboard with headers #39

achillis2 opened this issue Nov 2, 2022 · 1 comment

Comments

@achillis2
Copy link

The upper left square in the table can be clicked to highlight all and copy, but it doesn't include the headers. What option should we set to include the headers, not just the data rows? Thanks

@DataGridXL
Copy link
Owner

I believe we have already replied to your question on our main support channel, but here's the answer anyway:

Copying a selection of cells never copies the (column) headers. DGXL does not have a built-in option to copy the headers along with the cells (you can use grid.getData() for that).

One suggestion I have is to make your column headers part of the grid. I have created a Codepen demo to show you what I mean: https://codepen.io/datagridxl/pen/vYrGqBY.

var data = [
  ['header 1', 'header 2', 'header 3'],
  [1,2,3],
  [4,5,6]
];

Even if the headers are part of the editable cells, you can cancel any changes to the header cells. This way headers are copied, but not editable.

Please have a look at the Codepen demo to see how it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants