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

2 posts, 0 answers
  1. Joao Pedro
    Joao Pedro avatar
    1 posts
    Member since:
    Apr 2018

    Posted 11 Apr 2018 Link to this post

    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

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1201 posts

    Posted 13 Apr 2018 Link to this post

    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.
Back to Top