Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:42:24+00:00 2026-06-13T22:42:24+00:00

I am using the copy/paste feature implemented in Slickgrid ‘s slick.cellcopymanager.js which is working

  • 0

I am using the copy/paste feature implemented in Slickgrid‘s slick.cellcopymanager.js which is working fine (i.e. if you select some cells and press Ctrl+c then the content of these cells will be copied into your clipboard).

I would like to trigger the Ctrl+c action programatically (for instance to allow doing copy/paste by clicking buttons instead of pressing keys). I know how to define the keydown event for Ctrl+c:

var e = jQuery.Event("keydown");        
e.which = 67;
e.ctrlKey = true;

however I just can’t find out which object to trigger that event with and how so as to simulate the manual Ctrl+c. First I tried a simple trigger of the event which didn’t work:

–div_dom_from_selected_cell.trigger(e); // nothing happens
–grid_dom_wrapper.trigger(e); // nothing happens
–$('body').trigger(e); // nothing happens
–my_grid.trigger(e); // trigger is not a function

Then I extended slick.cellcopymanager.js so as to make the handleKeyDown function available externally:

$.extend(this, {
  "init": init,
  "destroy": destroy,
  "clearCopySelection": clearCopySelection,
  "handleKeyDown": handleKeyDown,          // ADDED THIS LINE
  "onCopyCells": new Slick.Event(),
  "onCopyCancelled": new Slick.Event(),
  "onPasteCells": new Slick.Event()
});

And tried to use it:

var copyManager = new Slick.CellCopyManager();
copyManager.init(my_grid);
copyManager.handleKeyDown(e, { cell: cell, row: row, grid: my_grid } );

The copying of the cell still doesn’t work despite:
-me having a cell properly selected (it has the selected class)
–handleKeyDown being fired properly
–e and args arguments inside handleKeyDown looking good (I’m tracing with console.log and can’t see any difference between manual Ctrl+c and programatic attempt`

How can I trigger the Ctrl+c event so as to copy a cell programatically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:42:26+00:00Added an answer on June 13, 2026 at 10:42 pm

    This worked for me running from the console on the example page.

    // Copy from row 2, column 5
    var row = 2, col = 5;
    grid.getSelectionModel().setSelectedRanges([new Slick.Range(row,col)]);
    var e = jQuery.Event("keydown");        
    e.which = 67;
    e.ctrlKey = true;
    grid.onKeyDown.notify(null, e);
    

    And then paste:

    // Past to row 3, column 4
    var row = 3, col = 4;
    grid.getSelectionModel().setSelectedRanges([new Slick.Range(row,col)]);
    var e = jQuery.Event("keydown");        
    e.which = 86;
    e.ctrlKey = true;
    grid.onKeyDown.notify(null, e);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on small php application using codeigniter I did just copy paste
I find it inconvenient using my browser to view JSON responses, then copy/paste the
I have the following block of jQuery code that I'm using to copy some
I'am using the below code to copy paste..but it doesnt copy the whole context
I'm using SWT Text component. Do someone know how can I handle copy/paste operation
I am using javascript function for copy/paste (CRTL+V) in textbox. Local run of the
I am designing a Copy/Paste Application for Windows os using Python.Now I want to
I am using google viewer api and I want to disable the copy paste
I'm trying to create a copy/paste system for a HTML table using jQuery and
I'm using the eclipse plugin for android development. When I copy/paste log contents from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.