Please help me in copy and paste in Grid using the Keyboard key press?
How can I copy the selected rows and paste in the corresponding selected rows?
If suppose I selected the rows from 1 to 5 and the mouse pointer is in the 7th row means I want to paste the entire 1 to 5 after the 7th rows…
the remaining rows is placed in after the pasted rows…
How can I select the below rows automatically when i am selecting the middle row.
Thanks & Regards
Udhaya
function onKeyPressed(code,ctrl,shift){
if(code==67&&ctrl){
// ctrl-c
}
if(code==86&&ctrl){
//ctrl-v
}
return true;
}
The grid provides API to copy rows to clipboard and to paster them back in grid
grid.rowToClipboard(row_id); //copy row to clipboard
grid.addRowFromClipboard(); //paster row from clipboard
If suppose I selected the rows from 1 to 5 and the mouse pointer is in
the 7th row means I want to paste the entire 1 to 5 after the 7th
rows…
the remaining rows is placed in after the pasted rows…
How can I select the below rows automatically when i am selecting the middle row.
Please check attached sample.
It stores list of selected items on ctrl-c, and use moveRowTo functionality to move row in new position on ctrl-v
1206971543.ZIP (1.72 KB)
But this code is not working. I am getting the Javascript error : " Object doesnt support this property or method."
When I implement the code in JSP Page it show the Error Message I am getting the Javascript error : " Object doesnt support this property or method."… I include all Javascript and CSS. In the Grid I Implement Redo,undo, Save using Data processor…
But this code is not working. I am getting the Javascript error
Please be sure that
- all js files mentioned in sample exists
- you are using dhtmlxgrid 1.5 pro
When I implement the code in JSP Page it show the Error Message I am getting the Javascript error
Please check updated sample, it must work correctly in both IE and FF
updated.zip (1.73 KB)
Hi Now its working… suppose I copy first and second Row and paste it in Grid… It paste as 2 and 1… Can you give me a solution for this…
2.If I edit a Cell, copy the data in the cell using Ctrl+c and paste it in another Cell using Ctrl+v, It doesnt perform the action… instead of these action it perform copy the entire row and paste to the next selected cell… How can I restrict the CELL Copy, paste and Row Copy, paste in the Grid using Ctrl + C and Ctrl+V
.If I edit a Cell, copy the data in the cell using Ctrl+c and paste
You can add next rule in onKeyPress handler
if (mygrid.editor) return true;
it will block custom logic while grid in edit state, so you will be able to use hotkeys during edit operations
When I copy 1,2,3,4 rows using Ctrl+c and paste it in Grid…
it pasted as 4,3,2,1
How can I avoid this situvation…
this is my copy paste coding is
function onKeyPressed(code,ctrl,shift){
if(code==67&&ctrl){
if (mygrid.editor) return true;
var ids=mygrid.getSelectedRowId().split(",");
mygrid._cp_buffer=ids;
}
if(code==86&&ctrl){
if (mygrid.editor) return true;
if (mygrid._cp_buffer){
var target=mygrid.getSelectedRowId().split(",")[0];
for (var i=0; i < mygrid._cp_buffer.length; i++) {
var id=mygrid._cp_buffer[i];
mygrid.moveRowTo(id,target,“copy”,“sibling”);
};
mygrid._cp_buffer=null;
}
}
return true;
}
You can update your code in next manner
if (mygrid.editor) return true;
var ids=mygrid.getSelectedRowId().split(",");
mygrid._cp_buffer=ids.reverse();
}