Empty string versus null in non-string-type cell

For cell types Numeric, Date or Time, at least, my table correctly starts life with value null in the cell, which displays as “empty”. If the user edits the cell but does not type anything, the cell’s value is updated to the empty string.

While this seems OK initially, other things can later go wrong, e.g. formula calculation, server-side processing, etc., because the value is now of the wrong type. As your documentation correctly states, for example:

Make sure your cell values are numbers and not strings as Handsontable will not parse strings to numbers.

These cell types should recognise setting to empty string and convert the "" value to null. This is applicable not only after editing a cell but also, for example, after pasting a value imported from Excel.

For now I have written a beforeChange hook to walk the changes[] array and alter it in-place in this situation, but may I suggest that Hot should do this automatically somewhere in its own code, possibly even before validation.

Thanks for sharing @jon

I have added you issue at our Github board: https://github.com/handsontable/handsontable/issues/3927
I fully agree with you, the value should not be overwritten.

If I’m missing some crucial facts or there will something important regarding this task please do not hesitate to leave a comment at https://github.com/handsontable/handsontable/issues/3927

Hi @aleksandra_budnik,

Your GitHub write-up is accurate; thank you for acknowledging the issue.