Copy/Cut from one row and Paste it to another row

We have tried Copy and Paste function with following link,

https://stackblitz.com/edit/angular-pequx9-qqus9w?file=app.component.ts


but when run it throws an error, 

copyContent is private and only accessible within class 'clipboard'.ts(2341)


import { ComponentOnInitViewChild } from '@angular/core';
import { sampleData } from '../jsontreegriddata';
import {ClipboardModulefrom '@angular/cdk/clipboard';
import {
  SortService,
  ResizeService,
  PageService,
  EditService,
  ExcelExportService,
  PdfExportService,
  ContextMenuService,
  TreeGridComponent,
  
from '@syncfusion/ej2-angular-treegrid';
import { EditSettingsModel } from '@syncfusion/ej2-treegrid';
import { ContextMenuClickEventArgs } from '@syncfusion/ej2-grids';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  providers: [
    SortService,
    ResizeService,
    PageService,
    EditService,
    ExcelExportService,
    PdfExportService,
    ContextMenuService
  ]
})
export class AppComponent {
  public dataObject[] = [];
  public pageSettingsObject;
  public contextMenuItemsstring[] = [];
  public editingEditSettingsModel;
  public toolbarstring[];
  public editparamsObject;
  public rowIndexnumber;
  public cellIndexnumber;
  public selectionOptionsObject;
  
  @ViewChild('treegrid')
  public treeGridObjTreeGridComponent;
  contextMenuSettings: (string | { textstringtargetstringidstring; })[];
  treegridany;
  
  ngOnInit(): void {
    this.data = sampleData;
    {this.contextMenuSettings = [
      'AutoFit',
      'AutoFitAll',
      'SortAscending',
      'SortDescending',
      'Edit',
      'Delete',
      'Save',
      'Cancel',
      'FirstPage',
      'PrevPage',
      'LastPage',
      'NextPage',
      { text: 'Copy'target: '.e-content'id: 'customCopy'},
      { text: 'Paste'target: '.e-content'id: 'customPaste'},
    ];}
    this.selectionOptions = {
      type: 'Multiple',
      mode: 'Cell',
      cellSelectionMode: 'Box'
    };
    (this.editing = {
      allowEditing: true,
      allowAdding: true,
      allowDeleting: true,
      mode: 'Batch'
    }),
      (this.pageSettings = { pageSize: 10 });
    this.editparams = { params: { format: 'n' } };
  }
  contextMenuOpen(args): void {
    this.rowIndex = args.rowInfo.rowIndex;
    this.cellIndex = args.rowInfo.cellIndex;
  }
  contextMenuClick(args): void {
    if (args.item.id === 'customCopy') {
      this.treeGridObj.copy();
    } else if (args.item.id === 'customPaste') {
      var rowIndex = this.rowIndex;
      var cellIndex = this.cellIndex;
      var copyContent = this.treeGridObj.clipboardModule.copyContent;
      this.treeGridObj.paste(copyContentrowIndexcellIndex);
    }
  }
  
    
}


Can anyone can suggest where I went wrong?





5 Replies

PS Pon Selva Jeganathan Syncfusion Team October 12, 2021 03:48 AM UTC

Hi Chris, 
  
Thanks for contacting Syncfusion forum.   
  

Query: Copy/Cut from one row and Paste it to another row

 

We checked your query by preparing a sample(based on shared sample and code snippet), but we are unable to reproduce the issue at our end. 
  
Please refer to the below sample, 
  
Please refer to the below video demo, 
  

After following the above reference, still faced issue please share us the following details.

 

  1. If possible, reproduce the issue in the attached sample or share the simple issue reproducible sample.
  2. Kindly share the complete stacktrace details
  3. Share the video demo or screenshot of the issue.
  
The provided information will be helpful to provide you response as early as possible.   
  
Regards,   
Pon selva   
  



CJ Chris Johnson October 14, 2021 07:08 AM UTC

Thank you so much for your quick response.  Yes it finally worked for me.



Regards,

Chris Johnson



PS Pon Selva Jeganathan Syncfusion Team October 15, 2021 06:36 AM UTC

Hi Chris 
 
Thanks for the update. 
 
We are glad to hear your query has been solved. 
 
Kindly get back to us for further assistance. We are happy to assist you. 
   
Regards, 
Pon selva 



KS karan sharma March 10, 2022 03:46 AM UTC

thanks for wasting my time its still showing errors .



PS Pon Selva Jeganathan Syncfusion Team March 11, 2022 01:15 PM UTC

Hi Karan 
 
Thanks for contacting Syncfusion forum.   
 
Based on your query, we suspect that you are facing the issue on copy/ cut the row and paste into another row. We checked your query by preparing a sample, but we are unable to reproduce the issue at our end. 
 
Please refer to the below sample, 
 

After following the above reference, still faced issue please share us the following details.

  1. Kindly share the complete tree grid code example(both ts and html)
  2. Share the EditSettings details
  3. Share the package version details
  4. Kindly share the complete stacktrace details
  5. If possible, reproduce the issue in the attached sample or share the simple issue reproducible sample.
 
The provided information will be helpful to provide you response as early as possible.   
 
Regards,   
Pon selva   


Loader.
Up arrow icon