I have a checkbox cell in my table that receives a set of data from the database. The values it receives are either ‘true’ or ‘false’.
The problem occurs when I select or deselect one of the cells, causing the ‘false’ value to be duplicated in the filter.
How can I solve this problem? (I couldn’t simulate it in a demo version.)
Hi @jonatas.locateli
We will need a code demo where the problem can be replicated, without we are not able to advise any solution.
Here’s an example:
Handsontable example - JSFiddle - Code Playground
When the checkbox is selected, or when the selection is removed, the values ’true’ or ‘false’ are duplicated in the filter.
@jonatas.locateli
Thank you for the demo. I checked it, and it’s actually correct behavior. You have predefined state of the checkbox cells. Two as false and one as true. Then, if you uncheck the cell with true value, there are still two with false state, and that is reflected in the filtering menu.
@adrian.szymanski , I have an initial load with three values in this example, two as ‘false’ and one as ‘true’. At this point, before any changes, the column filter contains two values, ‘true’ and ‘false’, which is correct. However, the problem occurs when I start changing the column values. For example, if I deselect the field that is set to ‘true’, instead of the filter list containing only the value ‘false’, it duplicates, appearing twice in the list with the value ‘false’, which is incorrect, as it should only appear once. The same occurs when I select or deselect other rows. I have the impression that when removing the selection from the field, the value ‘false’ is interpreted differently than what was already there in the initial load, leading to duplication of the same value in the filter list.
Hi @jonatas.locateli
I tested it more and I stil think it’s the correct behavior. I did additional tests also with no values declared at the beginning and it confirms my theory.
if I deselect the field that is set to ‘true’, instead of the filter list containing only the value ‘false’, it duplicates, appearing twice in the list with the value ‘false’,
That’s the situation I described in my previous message. It is correct result, as there are technically still two false values present.