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

Remove validation of a range of cells

3 Answers 295 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
David M
Top achievements
Rank 1
David M asked on 21 Apr 2016, 11:23 PM

I'm looking through your docs, and I can't seem to find an easy way to remove the validation on a range of cells.

I've tried passing an empty object to range.validation without success.  Any ideas?

3 Answers, 1 is accepted

Sort by
0
David M
Top achievements
Rank 1
answered on 21 Apr 2016, 11:33 PM

Figured it out.  Pass null into the validation method and it wipes it all out.  This spreadsheet tool is fantastic!

0
Prasadh
Top achievements
Rank 1
answered on 09 Oct 2018, 05:41 AM
Hi Can you please explain little more? It will be helpful if you post code snippet. My doubt is how to clear all the validations in the sheet before export to excel?
0
David M
Top achievements
Rank 1
answered on 11 Oct 2018, 02:26 PM

Hi Prasadh,

I did something like this:

var range = $("#spreadsheet").data("kendoSpreadsheet").activeSheet().range("A1:A100");  //Get the range of cells I want to remove validation from.

range.validation(null);  //Null out the validation

The only problem with this method, is that you need to re-create the spreadsheet widget after making a change like this.  (it may be fixed in a more recent build)

var storedSheet=$("#spreadsheet").data("kendoSpreadsheet").toJSON(); //Keep the sheet in JSON format for rebuilding later.

$("#spreadsheet").data("kendoSpreadsheet").destroy(); // destroy the Grid
$("#spreadsheet").remove(); // remove all Grid HTML - might be unnecessary

Then use the json spreadsheet data that you stored in storedSheet to rebuild your spreadsheet widget.

I don't know if this is still the most effective way to do this, but that's what I'm using.

 

 

 

 

Tags
Spreadsheet
Asked by
David M
Top achievements
Rank 1
Answers by
David M
Top achievements
Rank 1
Prasadh
Top achievements
Rank 1
Share this question
or