Dear community,
I tried copying the selected row by adding this code:
mygrid.attachEvent("onKeyPress",onKeyPressed);
function onKeyPressed(code,ctrl,shift){
if(code==67&&ctrl){
mygrid.setCSVDelimiter("t");
mygrid.copyBlockToClipboard()
}
if(code==86&&ctrl){
mygrid.pasteBlockFromClipboard()
}
return true;
}
Which is not a PRO function. However, it doesn’t seem to work.
What is meant by “block selection”? If I select a row and the whole row appears blue, is this not considered as block selection?
Cheers!
I’m sorry, I meant I have:
mygrid.enableBlockSelection(true);
And when I select a yellow area, and I try pressing command+c it won’t get copied to clipboard.
I also tried editing the code to:
function onKeyPressed(code,[b]shift[/b]){
if(code==67&&[b]shift[/b]){
mygrid.setCSVDelimiter("t");
mygrid.copyBlockToClipboard()
}
To try and copy with only shift+c
and I also tried the e.metaKey, but nothing seems to work. =S
Any ideas?
If the problem still occurs for you please, provide share with a demo link or provide with a complete demo, where the problem can be reconstructed locally.
Dear Sematik.
That sample actually doesn’t work for me…
I tried on a friends windows computer, and there it did work. Is this a function for windows only?
Is there something I can change to make the command key of a mac work as well?
function onKeyPressed(code,ctrl,shift){
if(event.metaKey){
if(code==67){
if (!myGrid._selectionArea) return alert("You need to select a block area in grid first");
myGrid.setCSVDelimiter("\t");
myGrid.copyBlockToClipboard()
}
if(code==86){
myGrid.setCSVDelimiter("\t");
myGrid.pasteBlockFromClipboard()
}
}
return true;
}
Sadly, that code doesn’t work. I have the exact same code snippet and when I mark a block and press cmd+c, it beeps (generic beep trying to use a keyboard shortcut when corresponding menu item isn’t available (copy, in this case).
function onKeyPressed(code,ctrl,shift){
if(event.metaKey){
if(code==67){
if (!myGrid._selectionArea) return alert("You need to select a block area in grid first");
myGrid.setCSVDelimiter("\t");
myGrid.copyBlockToClipboard()
}
if(code==86){
myGrid.setCSVDelimiter("\t");
myGrid.pasteBlockFromClipboard()
}
}
return true;
}
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan