1

I tried to copy the ag grid table to clipboard using class name when click on button but it was not working.

 copyTable() {       
            var tblDat= document.getElementsByClassName('tableStats');
            tblDat.select();
            document.execCommand('copy'); 
    }

1 Answer 1

2

Don't use document to select the data, AG Grid provides clipboard functionality to help with this.

Change your function to:

copyTable()
{
    this.gridApi.selectAll();
    this.gridApi.copySelectedRowsToClipboard();
}

This is will first select all the rows, then copy them to the clipboard.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.