I have a requirement where i do not wish user to copy data from certain Columns and only allow data to be copied from certain Columns.
How do i restrict copy functionality for columns in Grid
Hi PDev,
Greetings from Syncfusion support,
By reviewing your query to disable the edit option for a particular column field, you can use the allowEditing property set to false. Copy and paste will be disabled, and you have mentioned that to disable Copy and Paste for Cells If allowEditing property is set to false. The copied value could not be paste in cells. We have provided a API link and documentation for your reference.
API Link: https://ej2.syncfusion.com/angular/documentation/api/grid/column/#allowediting
Documentation : https://ej2.syncfusion.com/angular/documentation/grid/editing/edit#disable-editing-for-particular-column
Kindly get back to us if you have any concern.
Regards,
Harini K
Thanks. But this will not work.
My grid has 2 sections. left side has dropdowns while right side has timeline where user need to make an update on values i.e. number,decimals etc. that is where they need functionality to copy and paste. but left side of the grid is editable but past function should not work.
I was hoping you can show me how to use below code ?
Any update on this issue? We have noticed another issue. while dragging cell value to other cell. if cell has decimals, while dragging values i.e. 0.50 will paste 0.00 instead.
Please look into this as well.
Awaiting reply
Hi PDev,
Before we proceed with providing a solution to your query, we would like to request some additional information to better understand the issue you are facing. Please provide us with the following details:
We appreciate your cooperation in providing us with the requested information, as it will help us provide a more effective solution to your query.
Regards,
Hemanth Kumar S
Hi PDev,
Query: Disable Copy and Paste for Cells
As per your query we achieved your requirement by providing a two columns (customerID) and (shipCountry) columns. In customerID column we allowed to edit, copy and paste . In shipCountry column It allows to edit and it doesnot allows to copy and paste. We have used beforePaste() event to prevent paste in the specific column and In cellSelection() event we enable the args.cancel true. We have attached code snippet and sample for your reference.
Code Snippet:
beforePaste(args: { column: { field: string }; cancel: boolean }) { if (args.column.field === 'ShipCountry') { args.cancel = true; } } |
cellSelecting(args) { if ((this.grid.getRowInfo(args.currentCell).column as any).field === 'ShipCountry' ) { args.cancel = true; } } |
Sample: https://stackblitz.com/edit/angular-nsza63-p4xzzo?file=src%2Fapp.component.ts
Regards,
Harini K