Tree with filter: checkboxes are not handled correctly

Hi guys!
Please, check this example:
Scenario 1:

  1. Put a check mark next to ‘Camry’. You will see that a ‘dash’ mark will appear next to ‘Toyota’ and ‘Cars’ parent entries. Which is correct.
  2. Now type ‘corolla’ in search input. Now, that ‘Camry’ entry is no longer displayed, there will be no ‘dash’ mark next to ‘Toyota’ and ‘Cars’, because checkbox states are based on what is displayed, not on actual tree data. Which is not an expected behavior for me.
  3. Now, if you put a checkbox mark next to ‘Corolla’ entry, and do ‘tree.getChecked()’, you will only return ‘Corolla’ object as checked.
  4. Now, delete ‘corolla’ from search input. You will see that ‘Camry’ entry is still checked. Now if you do ‘tree.getChecked()’, you will get both ‘Corolla’ and ‘Camry’ objects as checked. Same output was expected in step 3, because despite ‘Camry’ entry was not displayed, it still WAS CHECKED.

Here is a screen record for you could better understand the steps: - Nimbus Capture

Scenario 2:

  1. Type ‘corolla’ in search input
  2. Now put a check mark next to ‘Corolla’ entry in tree
  3. You will see that a check marks are also being applied for ‘Toyota’ and ‘Cars’ parent entries. But the tree has ‘threeState: true’ option set, and ‘Toyota’ has other child entries besides ‘Corolla’ (which are currently not displayed), so it should be a ‘dash’ mark, not a check mark (same as ‘Cars’ has other child entries besides ‘Toyota’, so it also should be a ‘dash’ instead of a check mark).

Again, here is a screen record for you: - Nimbus Capture

So, this confirms that checkbox states are being calculated based on filtered results, not on actual tree data. Which seem to be an incorrect behavior from my point of view.

Anyway, my question is: can you advice some sort of a workaround here, for I could achieve a required behavior?
Thank you

Hi there again Webix team!
Will appreciate much if you answer in this thread.

@Listopad @annazankevich
Hello there!
You two are usually people who reply to most of my threads on this forum)
But this time I can’t get any reply for almost a month.
Can anyone get to me on this?
Will appreciate much.


Strictly speaking, the filtered out options are not checked. They are not in the tree anymore. They are not in DataStore order, they are not in DataStore branches. The only place they still exist is DataStore pull. Since getChecked works only with the data that are still in the tree (in the actual tree displayed), you can add your own method that will override the standard getChecked and will accept a boolean parameter, which, if set, will run your custom code that will look for checked items in pull:

something like

    if (hidden) {
       // run your custom search logic
      return [ /* result */ ];
    } else {
        return webix.ui.tree.prototype.getChecked.apply(this);
}, webix.ui.tree);