Events Not Firing Sequentially

Hi,

I am executing this JS inside a function triggered by a button click (CopyToClipboard Button). However, I see these events are not fired sequentially and copy command does nothing.

$$(“dataTable2”).selectAll();
document.execCommand(‘copy’);
$$(“dataTable2”).unselectAll();

Thanks

var copyStatus = document.execCommand(‘copy’);
copyStatus is false inside JS

See this answer

That didnt help as the snippet mentioned above is already called inside a function triggered by button click.

More Details: If i set a debug point at copy command and let the selectAll() method to complete execution completely, copy command is executed successfully with return value as true. Otherwise, it always returns false. Note: Entering a timeout delay before copy didn’t help.

Please note that widget selection has nothing to do with browser selection, which is copied with the execCommand function.

But you can enable the clipboard:true setting in the datatable to make it possible to copy selected items - either with Ctrl+C, or by execCommand API: https://snippet.webix.com/gw3npre7