DHTMLX Tree Multiselection

I’m using a DHTMLX tree with multiselection;

The requirement is that all the selected nodes should be checked when they are selected or multiselected.

Is there any API function or any solution for this?

If you want to check all selected items, it can be done as

var ids = tree.getSelectedItemId().split(",");
for (var i=0; i < ids.length; i++)
tree.setCheck(ids[i],1);