Hi, there's a problem with checkbox columns. When an empty row is added to a table, it contains #bad value# in checkbox cells and you cannot change this value to anything else - the cell is read only, stuck with #bad value# in it. I'd like to specify some default value for a new row, but there's no way to do so.
Version: 0.10.5
I'm seeing the same issue on 0.11.4:
See a running example here: http://jsfiddle.net/2xv3ojqa/
When minSpareRows is set and the table is empty then the checkbox column displays "#bad value#" for the initial row and all new rows. But that isn't the case when there is at least one existing row.
Thanks for reporting! We'll try to fix this within milestone 0.11.5. Stay tuned!
@zorab47 try to add dataSchema: {car: null, year: null, comesInBlack: null} into your settings.
Also happens when pressing delete on the checkbox cell..
@Berus @zorab47 adding dataSchema: {name1: null, ... , nameN: null} solved this problem for me.
Thanks so much. I was really panicking for a second there!
Is this fixed? I don't see it in any milestones anymore?
This issue still exists,
Go to http://handsontable.com/demo/checkbox.html.
Click do Edit in jsFiddle.
Remove 'available: false' from some item in the getCarData function.
Run! the issue remains.
I am also experiencing the same error. When I my cell has a value inside and I change it's type, it displays a #bad value#. If the cell value is null, then it's fine.
"#Bad value" also happens when you have an empty data set, ie. you are starting out with an empty table, that has only the columns and column headers predefined. This is in current master.
I also have the issue when I uncheck a checkbox and I use checkedTemplate and uncheckedTemplate.
You can try this jsfiddle :
http://jsfiddle.net/hzqobm5g/
Thanks for sharing @ichiriac I'm reopening this issue.
I have the same problem as ichiriac. If I use a checkedTemplate of 1 and an uncheckedTemplate of 0, I get #bad-value# when unchecking the box. Any workaround for this? I am using 0.26.0.
It's problem with checkedTemplate/uncheckedTemplate.
short list of the problematic conversions:
numeric -> numeric = #bad-value#
numeric -> boolean = #bad-value#
boolean -> numeric = #bad-value#
string -> numeric = #bad-value#
Any workaround for the moment ?
I try to set a checkbox by doing the following. Hot. GetCellMeta(0,0).type= "checkbox";. And i get #bad-value#
hi @mota57 I've tested this example here: http://jsfiddle.net/kt6racbp/ seems it works as expected
@AMBudnik if you paste text or drag a cell to the cell with the checkbox you will get #bad-value#
Thanks for sharing details and your prompt reply Marc.
I've managed to reproduce the cell type change.

The checkbox cell type is changing (copied) for the checkbox while it should stay the same (like for the date cell in the last row).
I don't think it's the first time that this bug is reported no ?
@AMBudnik ok but what if you want to put a checkbox on the first cell of the first column. ? It said #bad-value#. So how to handle that ? test it yourself.!!
Hey I think I fix what I was saying. So your code should look like this and the default value would be "false". Test it!!!!.
...but now I have another problem after I save the sheet and reload the data all those columns that had checkbox now contain only values like true or false....instead of the proper checkbox.
hot1.getCellMeta(lastCoordinates.startRow, lastCoordinates.startColum).type ="checkbox";
hot1.setDataAtCell(0,0,false);
hot1.render();
Thanks for sharing additional details @mota57 Unfortunately it works like that when there's a bug all actions taken after produce even more bugs.
The issue is not yet reviewed so each tips are highly apperciated.
Thanks to our trusted user Chow we have managed to take one step towards understanding this bug.
Here's an updated demo: http://jsfiddle.net/xu8fbqmL/
The change was to set the boolean value for the column while initialization.
Still we can see that the checkbox is shifted

@AMBudnik I am sorry but if you copy paste text in the checkbox cell, the type is still changing with #bad-value#.
Try to copy the first cell containing "Mercedes A 160" and paste it in the checkbox cell.
Although I am not sure if your change aimed that issue in particular..
You're right @marc-antoinepelletier
Thank you for your prompt reply and effort to check the case.
I have a feeling that this can be related to this issue https://github.com/handsontable/handsontable/issues/3540
@mota57 Let me make sure if I understand what you're trying to achieve. If you're trying to make the cell at (0,0) coordinates a checkbox, you'll need to either:
checkedTemplate/uncheckedTemplate (explained in our docs http://docs.handsontable.com/pro/1.6.0/demo-checkbox.html) Take a look at this example: http://jsfiddle.net/js_ziggle/2enh673x/
true/false, as these are the default checkbox template values, as in here: http://jsfiddle.net/js_ziggle/2enh673x/1/Otherwise the checkbox renderer wouldn't know what to render.
Similarly to @marc-antoinepelletier example:
Try to copy the first cell containing "Mercedes A 160" and paste it in the checkbox cell.
How would the checkbox renderer know if "Mercedes A 160" translates to "checked" or "unchecked"? I wouldn't know either :)
Oh, and the bug @AMBudnik found is probably caused by autofill moving the cell meta where it shouldn't, and it should be definitely fixed, but it's not connected with this isse.
@jansiegel I assume the checkbox renderer would check the value passed the cell, and if it's not a default boolean or any other default checkbox value you assigned in the setting, it would check the value or do nothing no ?
I had to make a custom checkbox renderer to translate this behaviour, I figure that should be handle by default in Handsontable no ?
@marc-antoinepelletier I'm not sure what you mean by
it would check the value or do nothing
What the renderer does is checking if the cell value is the same as the one defined in the templates, and if there are none, check if the value is a boolean. If nothing passes that verification it displays #bad-value#, as it means the cell's value is not supported by the renderer.
I meant it would check (true value) or leave the cell as it is without updating it. From what you are saying, the most logic way would be that nothing should happen to the checkbox cell at the end instead of displaying #bad-value# if the value doesn't correspond no ?
@marc-antoinepelletier Ok, now I get it. Thanks for clarifying!
I think it's a good idea for a new feature - setting the allowInvalid property to false for the checkbox-typed cell would work just like you explained. The property is currently available for the autocomplete and date editors, but it would be also useful for the checkboxes.
I've created a new issue for this: #3755
@jansiegel Awesome, Thanks ! :)
Most helpful comment
This issue still exists,