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

Sheet validation, not sure how to set this up properly

2 Answers 66 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 10 May 2018, 08:35 PM

So I need my spreadsheet to have a header row, and every row below be where the data is entered... so I've got that setup fine I think.

Now I need to define validation rules on ranges, so like K2:K40 can only have 1-5... I was able to do this in the widgetCreated event

sheet.range("K2:K40").validation({
                type: "warning",
                from: "1",
                to: "5",
                allowNulls: true,
                comparerType: "between",
                dataType: "number",
                messageTemplate: "PGYs are 1-5"
            });

 

My current struggle though is being able to find out the total validation errors in the sheet... the code provided here

https://www.telerik.com/forums/retrieve-validation-errors-programatically

and here

https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/how-to/get-flagged-cells

Always fails, the "cell.validation" in range.forEachCell is always undefined... what am I doing wrong here?

 

2 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 10 May 2018, 08:40 PM
Scratch that, found the problem, this is setup correct, it's just $scope isn't available in the change event...eugh
0
Joana
Telerik team
answered on 14 May 2018, 12:43 PM
Hi Steve,

I am glad that you managed to pin down the cause of the issue.

In the change event of the SpreadSheet widget you could take reference of the scope as follows:

change: function (e) {
  console.log(this.$angular_scope);
}

http://dojo.telerik.com/@jivanova/oqaHagAW

Regards,
Joana
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
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Joana
Telerik team
Share this question
or