Issue with checkbox, not getting checked on row selection

I’ve an issue with checkbox not getting checked on row selection.

https://webix.com/snippet/75dbcd67

In the above snippet, checkbox will get checked only on double click. I have written the check event on “onBeforeSelect” .

Also need to uncheck when clicked again.

Hello!
Please, use onAfterSelect which fires after row was selected and updateItem which updates an item with new properties where we changed the state of checkbox

  on: {
      onAfterSelect:function(id) {                
        var item = this.getItem(id);        
        if (item.$level === 1){
          var state = this.getItem(id).ch1
          this.updateItem(id, {ch1:!state})        	
        }
      }
    }

Here is an example: https://webix.com/snippet/9018808c

hi,
Thank you for the help.
I have encountered an issue with “onCheck”. I was trying to add row selection using grid.select() and unselect using grid.unselect(). But in the end checkbox stopped working on single click.Any suggestions here?
https://snippet.webix.com/2l4lfu0v

Row Selection checking is working fine, but Checkbox checking has the issue.

Can anyone throw some light on this.

Hello,
Please, try to use onItemClick event instead of onAfterSelect event
Example: https://snippet.webix.com/cc587iq1