# Need help To remove Constraints

siva477
57

Hi,

I create some dynamic components with in the TREE structure. With in the build stage i set constraints to all the components. Is it possible to clear the constraints of all the components when i need to remove. Components are may be textbox, decimalbox, combobox.....etc

NOTE: There is no identity for each component.

With Regards,
Siva Kumar.M

delete retag edit

vincentjian
2245 6

Hi,

It is better not to create Tree dynamically. If it is not possible to avoid, it is recommended to specify id to input component if the creation phase has some information that is unique.
However, you can try using the following untested code:

Tree tree = (Tree) Path.getComponent("path/to/treeId");
for(Treeitem treeItem : tree.getItems()) {
for(Component treeCell : treeItem.getTreerow().getChildren()) {
for(Component comp1 : treeCell.getChildren()) {
if(comp1 instanceof Textbox) {
((Textbox) comp1).setConstraint("");
}
}
}
}


The sample code above is not complete due to Tree structure is complicated with Treechildren, Treeitem, Treerow and Treecell. Therefore, I assume the tree depth is 1.

[hide preview]