How to hide expander icon in filtered tree grid when no children remain aft

How to hide expander icon in filtered tree grid when no children remain after filtering ?

I’m using a TreeGrid component and apply a filter on the TreeDataProvider. When a parent node of the tree passes the filter, but none of its children do, it cannot be expanded, but still shows the expander icon (in its collapsed form). Is it possible to hide this icon in case a node has no children after the filtering ?

I solved this like this for now, but really this should be done by the framework ?

  1. Add a custom style class in case no children are left after filtering
TreeDataProvider<TreeEntry> dataProvider ...
treeGrid.setStyleGenerator(node -> {
		int numChildren = dataProvider.fetchChildren(new HierarchicalQuery<>(this.dataProvider.getFilter(), node)).count();
			return numChildren <= 0 ? "no-expander-icon" : null;
		});
  1. Add css to hide the icon
  .no-expander-icon .collapsed::before {
    content: "" !important;
  }

tulip wood:
I solved this like this for now, but really this should be done by the framework ?

  1. Add a custom style class in case no children are left after filtering
TreeDataProvider<TreeEntry> dataProvider ...
treeGrid.setStyleGenerator(node -> {
		int numChildren = dataProvider.fetchChildren(new HierarchicalQuery<>(this.dataProvider.getFilter(), node)).count();
			return numChildren <= 0 ? "no-expander-icon" : null;
		});
  1. Add css to hide the icon
  .no-expander-icon .collapsed::before {
    content: "" !important;
  }

Hi,

Thanks for the suggestion, in order to prevent click, i replaced

	  .no-expander-icon .collapsed::before {
		content: "" !important;
	  }

with

	//Remove the collapse expand icon
  	.no-expander-icon .collapsed {
    	visibility: hidden !important; 	
  	}