I have been experiencing a few issues with copying and pasting using the keyboard and I have included the solutions below in case they should be of use to someone.
The first problem I had was that when editing a cell if I tried to paste data using ctrl-v then the grid would close the cell editor (loosing any changes) and attempt to paste the data as a block selection. To prevent block pasting whilst the user is editing (and have any data pasted into the cell editor instead) add if (!mygrid.editor) { … } around the copy/paste code.
Secondly I was having a problem whereby I’d have to select a row on the grid before keyboard copy/pasting would work. To solve this you can call the mygrid.setActive(); method to make your grid the currently active dhtmlxgrid on the current page.
mygrid.attachEvent(“onKeyPress”,onKeyPressed);
mygrid.setActive();
function onKeyPressed(code,ctrl,shift){
if (!mygrid.editor) {
if(code==67&&ctrl){
mygrid.setCSVDelimiter("\t")
mygrid.copyBlockToClipboard()
}
if(code==86&&ctrl){
mygrid.pasteBlockFromClipboard()
}
}
return true;
}
Both updates incorporated in main code branch and will be available as part of next version ( 1.4 )
Thanks for your code improvments.