This is a migrated thread and some comments may be shown as answers.

Only allow float numbers in my cell input without using spreadsheet validation

1 Answer 258 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Joao Pedro
Top achievements
Rank 1
Joao Pedro asked on 12 Apr 2018, 01:27 AM

Hello.

I have 130k+ cells in my spreadsheet and if I load all those cells with validation my grid takes a lot longer to load. (Something around 8-12 seconds), so I decided to not use validation. 

 

Is there any other way to only allow float numbers in my cells? I'm down to use an 'on-change' trick or something like that.

 

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 13 Apr 2018, 03:08 PM
Hi Joao,

Using the change event of the Spreadsheet may not be the most appropriate option for the described scenario, as it does not allow prevention of the changes made. Nevertheless, I could suggest you to use the select event instead and if it is needed, apply the validation run-time on the selected cell (range):
$("#spreadsheet").kendoSpreadsheet({
  select: function(e) {
      // Check here if validation should be applied
    if (true) {
      e.range.validation({
        dataType: "number",
        comparerType: "between",
        from: 0,
        to: 1000,
        allowNulls: true,
        type: "reject",
        messageTemplate: "The value should be a number."
      });
    }
  }
});

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Spreadsheet
Asked by
Joao Pedro
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or