Skip to main content

Copy cell value from IG (global edition)


There is an article (more like a reply from grid master John Snyders) about how to enable cell copy from interactive grid. It has some limitations, at least for my use case. Some grids don't have static_id, it ignore some cells (with HTML code) and I want all grids behave the same without putting anything into the JavaScript initialization block.

I have spent too much time researching how to do that properly and then I wrote this code. Just put it to onload event in your app, no need to adjust individual pages or grids.

document.addEventListener('copy', (event) => {
    event.clipboardData.setData('text/plain', $(document.activeElement)[0].innerText || window.getSelection());

When you select a cell in a grid and copy it to clipboard, the text value from selected cell will be copied no matter the cell type (read only, display only, link...). You can still do partial text selections on input fields. And you can/will copy anything else from the page as plain text too.

Small update: I know about the F8 trick (Actions - Selection - Cell Selection) to switch to individual cells, but that has 2 issues. First, you have to explain this to users and it might be too complicated for them. Second, you dont see whole row highlighted anymore, just the cell, so it is easy to get lost.