Kendo Spreadsheet not working range validation on copy and paste data for numerical type data

1 Answer 184 Views
Spreadsheet
GAURAV
Top achievements
Rank 1
GAURAV asked on 22 Sep 2022, 12:27 PM

Hello,

 

I have applied range validation for numerical type data it's working until i'm entering single record but it's not working when i'm paste multiple record it's not validating please give me any solution.Thank you

 

 sheetForRootCause.range("G2:G300").validation({
        dataType: "number",
        from: "1899",
        to: "2050",
        comparerType: "between",
        allowNulls: true,
        type: "reject",
        titleTemplate: "Year validation error",
        messageTemplate: "Year should be between 1899 and 2050 year."
    });

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 27 Sep 2022, 07:27 AM

Hello Gaurav,

By default copy-pasting to a Spreadsheet cell will override all the cell properties. In case there is validation configured in the Spreadsheet and the user is copy-pasting data in cells that have a validation rule defined, pasting something in those cells will remove the validation. The reason for that is the fact that the paste action will entirely erase the existing cell data (values and configuration) and add the new data. In order to limit the Spreadsheet to allow pasting only values, you should implement an override for the Spreadsheet paste event as shown in the following knowledge base article:

- https://docs.telerik.com/kendo-ui/knowledge-base/spreadsheet-paste-only-values

Please, note that in a paste scenario the validation will fail and the cell will be marked as invalid. Its new content, however, would not be rejected as that will happen only for direct text input.

Let me know in case you have further questions on the matter. 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Spreadsheet
Asked by
GAURAV
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or