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

Text cell with required validation

3 Answers 155 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
iFACTS Admin
Top achievements
Rank 1
iFACTS Admin asked on 02 Nov 2018, 10:25 AM

Hi!

I am attempting to add required validation to a text cell.

Here's a demo attempt: https://dojo.telerik.com/uPoZUgAy/3

I only succeed if I uncomment the function in the "from" property, otherwise it crashes. 

The fix I found is probably a hack-y approach, so I am opening this thread to find the recommended approach for my situation...

 

Thanks!

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 06 Nov 2018, 11:15 AM
Hi Peter,

An empty cell that should not be empty gets a small triangle that has a comment with the validation message, much like an Excel comment. This is switched on through the allowNulls: false setting.

 

The empty cell validation in the spreadsheet widget is a little more discreet than what you seem to be looking for because having such popups is likely to cause performance issues and reduce usability. This is the most significant reason why the delete operation is not validated and users are allowed to clear out a cell easily.

If you want to make such cells stand out, you can add a CSS class override to to that: https://dojo.telerik.com/@bratanov/IPIPeLUW/2. It result in the following when you clear out the cell: https://www.screencast.com/t/GPbetxKXp.

I have also added this enhancement request to our backlog and you can monitor its status in the following page: https://github.com/telerik/kendo-ui-core/issues/4648.

You can also employ the approach from the following article to review the cell validation status of the sheet and collect invalid cell info so you can inform the user that they need to take action with some custom UI (e.g., some dialog, notification alert or other approach suitable for your needs). Link: https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/how-to/get-flagged-cells.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
iFACTS Admin
Top achievements
Rank 1
answered on 06 Nov 2018, 11:48 AM

Marin, thanks for the useful information.

But I think I wasn't very clear in my description of my issue :)

Setting validation.allowNulls: false, as I want and as you suggested, will trigger an error (try it in my demo code). I only get around that issue if I set the validation.from as well. Think it, through trial and error, I noticed that the crash goes away if I put an empty function as the value of validation.from.

Is this the right way to make a cell required?

 

Thanks!

0
Marin Bratanov
Telerik team
answered on 06 Nov 2018, 12:02 PM
Hi Peter,

Yes, this is the way. You will also see that my example also contains some (dummy) from function. The from setting is mandatory and I have added this info to the documentation (and it will be live soon). Depending on the enhancement implementation, this may change, but I cannot say at this point whether from will still be mandatory for this scenario (it is likely that it will be since this is generally mandatory for validation).


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
iFACTS Admin
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
iFACTS Admin
Top achievements
Rank 1
Share this question
or