Hi,
I am trying to add checkbox on a particular cell based on certain conditions. Is it possible to do that.If yes, then how.
Checkbox in a cell
Hi,
For example, if there is a cell which has a row number 2 and column Name ‘Title’, i need a checkbox in that particular cell along with the data already present. Also i want the event when that checkbox is clicked.
I have loaded row number and column Name from the back end based on business requirement.
All i want to know that is it possible to have a checkbox in any cell and the event corresponding to that checkbox.
Thanks
You can use the getRowHeader(index)
and getColHeader(index)
to check what are the headers. You may need to run a loop.
https://jsfiddle.net/qt4560pg/
To track changes of cells (checkbox included) you can use the afterChange
hook https://jsfiddle.net/qt4560pg/1/
Hi,
In your fiddle is it possible to add checkbox at B4(row: 4, column: Name). If yes, can you please send the updated fiddle
The requirement is to add checkbox at any particular cell and not the whole column.
Thanks
Hi,
Now we are talking.
Now if we change the code at line number 23
//attach value to checkbox
hot.setDataAtCell(3, 1, true)
to
//attach value to checkbox
hot.setDataAtCell(3, 1, “abc”)
Then the value in the cell changes to #bad-value#.
So now the question becomes, can we add data along with the checkbox in a cell.
In the cell i want checkbox and along with that checbox in the same cell i need some data also.
Can we do that?
Thanks
Maybe label
resolve your issue - https://handsontable.com/docs/7.4.2/demo-checkbox.html#labels?
Here is a demo using the label - https://jsfiddle.net/ya0b4mhp/
Hi @piotr.nowak,
Label works with column i guess. Here we want to add checkbox and data in a particular cell and not in the whole column
Hey @abhishek3092
you just need to use @piotr.nowak demo to pass the same via cells
https://jsfiddle.net/h8f26pm5/