Datatable with checkbox column issue

Hello webix team,
Please refer this snippet: https://snippet.webix.com/888y25ni

Here, I have a datatable with checkbox column. I want to select/unselect checkbox on row selection & vice vera. but when I select row and set checkbox value to ‘on’ It doesnot fire onChange event. Please provide solution for it.

Thank you.
Regards,
Pooja.

Hello @Pooja,

when I select row and set checkbox value to ‘on’ It doesnot fire onChange

I’m not quite sure what you mean by this, since the datatable does not have an onChange event, and the onCheck event does get triggered.

Considering the desired functionality, the best way to approach your case would be the following: https://snippet.webix.com/0as7r2a5.

Here is the overall principle of how this works:

  • As you check a row trigger the onAfterSelect event, the same goes for unchecking the row → trigger the onAfterUnSelect event
  • As you select a row trigger the onCheck event and change the value of the actual checkbox, the same logic is applied as you unselect the row.
  • Ensure that the code does not enter a loop since you are cycling selections and checks.
  • In the case you want to make use of the master checkbox some additional logic is required: a custom master checkbox needs to be implemented and the appropriate checks need to be done in the onCheck event (check master checkbox as you check every row)

@Dzmitry thanks for the given solution.
I have refered below for onChange event .
https://docs.webix.com/api__ui.datatable_oncheck_event.html