Dynamic label value for checkbox

Tags: #<Tag:0x00007efc60013368>

Hi, I would like to know, is there a way of dynamically changing the label for the checkbox based on whether it is being selected or not?

I followed this Tutorial for implementing the checkbox with label : https://handsontable.com/docs/8.2.0/demo-checkbox.html

Example:

{
      data: 'comesInBlack',
      type: 'checkbox',
      checkedTemplate: 'yes',
      uncheckedTemplate: 'no',
      label: {
        position: 'before',
        value: 'In black? '
      },
},

In the above configuration is it possible to set ‘In black’ when selected and ‘Not in black’ when the checkbox is not selected?

Thanks

Hi @santhoshnarme

Yes, the value of a checkbox can be a function that returns[row index, columns index, key, value]. This is how you can use it https://jsfiddle.net/handsoncode/3eaxdbt1/

ps. thank you for asking this question. I see that we do not mention about the value being a function in the documentation. I will report it.