Posted 14 February 2020, 10:48 am EST
Hello i want to simulate the cut/copy and paste event on the button, or maybe create a custom button , and trigger to click some items (that cut/copy/paste) on the context menu for the event ?
Forums Home / Spread / SpreadJS
Posted by: jerome on 14 February 2020, 10:48 am EST
Posted 14 February 2020, 10:48 am EST
Hello i want to simulate the cut/copy and paste event on the button, or maybe create a custom button , and trigger to click some items (that cut/copy/paste) on the context menu for the event ?
Posted 18 February 2020, 5:33 am EST
Hi,
Cut, Copy and paste clipboard operation can be performed on button click using the Standard Clipboard API. Please refer to the following documentation link for reference:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard
Also, you may customize the contextmenu as per your needs. Please refer to the following demo sample for reference:
https://www.grapecity.com/demos/spread/JS/TutorialSample/Features/ContextMenu/customMenuView/purejs
Regards,
Manish Gupta
Posted 18 February 2020, 10:19 am EST - Updated 3 October 2022, 10:30 am EST
hello @manish.gupta, thanks for the reference, i mean i want to create a custom button that have functionality for the copy/cut/paste function that will trigger on sheet like this
cause we have our own toolbar(this custom button) for this functionality, how can i trigger like that ?
document.querySelector(“#copy”).addEventListener(“click”, function(){
// ???
});
thanks
Posted 19 February 2020, 4:47 am EST
Hi,
As we understand, you have a toolbar separated from SpreadSheet. This toolbar has buttons that would be used to perform clipboard operations the same as contextmenu.
SpreadSheets several commands which can be used to perform the desired operation from outside the SpreadSheet. Please refer to the following demo sample command list:
https://www.grapecity.com/spreadjs/demos/features/worksheet/custom-action#
http://help.grapecity.com/spread/SpreadSheets12/webframe.html#SpreadJS~GC.Spread.Sheets.Commands.html
Hope it helps!
Regards,
Manish Gupta
Posted 24 February 2020, 10:04 am EST
thanks i try this your suggestion