How to delete all the child nodes when deleting a node in the Hierarichal datasource

Hi,
I am using tree table and using hierarchal data source… Can anybody guide me, how to delete all the child nodes when deleting a node in the tree table…

Hello, @Narayanan

You should use your own RemoveAction that will traverse through a hierarchy and remove all children.

[deleted]

Regards,
Daniil.

I need to use the Hierarchical data source… As i was using treeTable… So, is that any possible to delete all the child nodes in all level using the Hierarchical Data source…? Because i cannot use the GroupDataSource for TreeTable…

I’m sorry, i’ve shared wrong links. Here is what you need:

Thanks for the reply Daniil… I can only able to delete the first level children of a node… How can i delete the entire children levels…

The code i used…

try {
    EnterpriseProjectStructure eps = metadata.create(EnterpriseProjectStructure.class);

    Iterator<UUID> iterator = enterpriseProjectStructuresDs.getChildren(enterpriseProjectStructuresTable.getSingleSelected().getUuid()).iterator();
    while (iterator.hasNext()) {
        selected.add(enterpriseProjectStructuresDs.getItem(iterator.next()));
    }

    super.doRemove(selected, autocommit);
}
catch (Exception e) {
    showNotification("Error" + e.toString());
}

Is there any function to retrive the entire level of children… Or how can i traverse thru all the child nodes…?

You should write a code with recursion that will check whether an item has children or not and if it is so, all actions should be repeated for nested hierarchy.