|
created(args){
document.addEventListener('keydown', function (e) {
if (e.keyCode === 88) {
this.flag = true;
for (var i = 0; i < this.grid.getSelectedRowCellIndexes()[0].cellIndexes.length; i++) {
this.fieldData.push(this.grid.getColumnByIndex(this.grid.getSelectedRowCellIndexes()[0].cellIndexes[i]).field);
}
this.cutIndex = this.grid.getSelectedRowCellIndexes();
this.grid.copy();
}
}.bind(this));
}
beforePaste(args) {
if (this.flag == true) {
for (var i = 0; i < this.cutIndex.length; i++) {
var rowInfo = this.grid.getRowInfo(this.grid.getRowByIndex(this.cutIndex[i].rowIndex))
for (var j = 0; j < this.fieldData.length; j++) {
if (rowInfo.rowData[this.fieldData[j]] != '') {
this.grid.updateCell(this.cutIndex[i].rowIndex, this.fieldData[j], '');
}
}
}
}
} |
Thank you so much. Yes, this what I expected, now need to place it in contextmenu Cut and Paste; will get you back if we need any help from your side.
Regards,
Chris Johnson
Hi Thiyagu,
I have one more doubt, the sample which you have done is in normal grid right?, suppose in case if we need implement in to treegrid, what changes should be made to this? can you please suggest?.
Thanks and regards,
Chris Johnson
Hi Thiyagu,
Can I get a response please or should I open a new ticket?.
Thanks and regards,
Chris Johnson
Hi Thiyagu,
We have minor query, you have give the solution so as we can use ctrl+X for cut and ctrl+V for paste, its perfect. Now we tried to implement Cut and Copy function in context menu, we succeeded with Paste, but couldnt get a proper output for Cut. When clicking ctrl+X and clicking Paste it works. Can you help us out.
Thanks and regards,
Chris Johnson
Hi Balaji,
Alright. No issues, will wait. Thanks for your update.
Thanks and regards,
Chris Johnson
|
[app.component.ts]
contextMenuClick(args) {
if (args.item.text == 'Cut') {
this.flag = true;
for (
var i = 0;
i < this.grid.getSelectedRowCellIndexes()[0].cellIndexes.length;
i++
) {
this.fieldData.push(
this.grid.getColumnByIndex(
this.grid.getSelectedRowCellIndexes()[0].cellIndexes[i]
).field
);
}
this.cutIndex = this.grid.getSelectedRowCellIndexes();
this.grid.copy();
}
} |