Thanks for the shared details, however, it's not really clear what you are trying to achieve. The TreeView check directive handles the checkedChange event and implements its own isChecked callback. So, I'm not sure where the problem is here. If you want to run your own logic on how to persist the keys, you shouldn't be using the directive, as unexpected behavior may be observed.
If you still want to use the directive to take advantage of the checkedChange handling, but still want to control whether an item is marked visually as checked or not, it's advisable not to alter the checkedKeys collection on your end, and just provide your own isChecked implementation.
From what I can see from the shared code snippet, you expect the items to be checked by an object property value, and not by item index (which is the default check directive behavior). In this case you should first provide to the directive what object key value it should track the checked status by. This is done via the checkBy property of the directive.Then, when a checkBy value is provided to the directive, it can no longer track the indeterminate state of parent items. If this is the problem you are facing than this example should be of help to you. Note, that I don't handle the checkedChange event manually - this is done by the directive. Also, a checkBy value is specified. I've just inserted my own isChecked function that asserts the checked state of each item.
If this is not the problem you are facing, I'd ask you to elaborate what exactly are you trying to achieve.
Let me know if further assistance is required.
Progress is here for your business, like always. Read more
about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.