Tree Table - removing some nodes not needed
735308Sep 28 2010 — edited Sep 29 2010Hi,
I am using ADF 11g.
I have a 3 view objects vo1, vo2 and vo3 and the data model on the app module is that vo2 and vo3 are children of vo1.
vo1
---- vo2
---- vo3
Please note that vo1 , vo2 and vo3 are all read only view objects.
I drag and drop the data control of this vo1 instance on a JSF page as a ADF tree table.
While editing tree binding, i add vo2 and vo3 instances as well to the root tree of vo1.
When i run the page, the o/p is seen as below
vo1-row1
----- vo2root
---- vo2-row1
----vo2-row2
------vo3root
vo1-row2
------vo2root
-------vo3root
--------vo3-row1
---------vo3-row2
1) I would like to remove the empty vo3root under vo1-row1 and vo2root under vo1-row2 even though its a read only view object.
Here is a code snippet to remove, i see that the sucess msg comes but not able to see the node removed on the page when i run it even though i have partial target call made.
List<JUCtrlHierNodeBinding> firstchildren = root.getChildren();
if (firstchildren!=null){
for (JUCtrlHierNodeBinding node:firstchildren){
System.out.println("the nodefirstchildren is "+node.getRow().getAttribute(0));
List<JUCtrlHierNodeBinding> secondchildren = node.getChildren();
for (JUCtrlHierNodeBinding childnode:secondchildren){
if (childnode.getChildren() == null){
if (*node.removeChild(childnode)*){
System.out.println("removed successfully");
AdfFacesContext.getCurrentInstance().addPartialTarget(richTable);
}
}
}
}
}
2) Also, is there a way to remove the label/root node vo2root and vo3root easily under the vo1 rows and just show the leaf nodes of vo2row1,etc and vo3row1 , etc.
If i see the page def file , heres the xml part
<tree IterBinding="vo1Iterator" id="vo1">
<nodeDefinition DefName="views.vo1"
Name="vo10">
<AttrNames>
<Item Value="col1"/>
</AttrNames>
*<Accessors>*
*<Item Value="vo2"/>*
*<Item Value="vo3"/>*
</Accessors>
</nodeDefinition>
<nodeDefinition DefName="views.vo2"
Name="vo1">
<AttrNames>
<Item Value="col2"/>
</AttrNames>
</nodeDefinition>
<nodeDefinition DefName="views.vo3"
Name="vo1">
<AttrNames>
<Item Value="col3"/>
</AttrNames>
</nodeDefinition>
</tree>
Bcos of the Accessor element in bold, i get those inbetween labels of vo2 and vo3. Is it possible at all to remove them?
Thanks a lot for any help.
Edited by: Jay on Sep 28, 2010 1:40 PM
Edited by: Jay on Sep 28, 2010 1:45 PM