Need to enable submit button to save record if all the cell are valid. I have used the “validator” to check the single column validation during edit action. But I need to validate during loading the existing data into the spreadsheet if there is no valid data. At the same time having two spreadsheet table in a single page, so how to get which spreadsheet table data is invalid.
Hi @kiruba
I am not sure about the scenario
Here’s a little demo that I’ve made http://jsfiddle.net/attz3zok/
What should I add to replicate the issue?
Thanks @aleksandra_budnik for you demo. Just delete any one value or change the value as zero from the spreadsheet, then the submit button need to be “disabled”, or need to show warning message “Empty spreadsheet will not allow for save” if click on the submit button.
If you do not want to allow users to leave a blank cell you can use the allowEmpty
option. When the option is set to false
the cell doesn’t pass the validation.
Here is a working demo http://jsfiddle.net/jsdb5x4a/
I have added a beforeValidate
hook for both tables
beforeValidate: function(value) {
console.log(value);
if (value === '') {
return false
}
},
and then added a workaround (related to this issue https://github.com/handsontable/handsontable/issues/3101)
hot.addHook('afterRender', function() {
hot.validateCells();
})
at lines 60-66 (also for both tables).