Hi @kranthikumar.reddy32
I see that it’s a similar topic to Cell Validation Not working Properly (also regarding settings up cell dependencies). I think that in this case you can use afterChange
hook and setCellMeta()
method.
The are some changes needed in the demo but you took a good approach. the changes[0][3]
is the new value, changes[0][4]
does not exist.
The setCellMeta()
has a different structure, the correct on in your case would be
hot.setCellMeta(changes[0][0], 2, 'allowEmpty', false)
hot.setCellMeta(changes[0][0], 2, 'required', true)
Then we need to call the render()
method to attach the cell meta once user does the changes.
But there one additional thing to remember here is to add a validator (it is not yet present in the demo), as the allowEmpty
would not work without a cell validator https://handsontable.com/docs/react-data-grid/api/options/#allowempty
Full code
afterChange(changes, source) {
if(changes){
if(changes[0][3] == 'Yes'){
hot.setCellMeta(changes[0][0], 2, 'allowEmpty', false)
hot.setCellMeta(changes[0][0], 2, 'required', true)
hot.render()
}
}
}