Hi All,
Jdev : 11.1.1.7 Windows 10.
I have a af:tree populated through pojo model. Also I have customized the icon with css as folder open and close icons.
Requirement: children nodes should expand on selection/click of parent node text as well. By default we can also expand/collapse using the default provided icon.
Issue : Custom javascript is getting conflict with default Icon link. Sometimes its not closing at all and keeps open. Javascript works fine when I click only on the node text, but when I click on the default icon, its not collapsing sometimes. (default icon click also calls my custom javascript)
function expandDiscloseNode1(event) {
var _tree = event.getSource();
rwKeySet = _tree.getSelectedRowKeys();
var firstRowKey;
try{
for (rowKey in rwKeySet) {
if(!isNaN(rowKey)){
firstRowKey = rowKey;
break;
}
}
if(firstRowKey != null){
if (_tree.isPathExpanded(firstRowKey)) {
_tree.setDisclosedRowKey(firstRowKey, false);
}else {
_tree.setDisclosedRowKey(firstRowKey, true);
}
}
}catch(e){
}
}
jsff Tree code:
<af:tree id="_menuId" summary="MENU"
initiallyExpanded="true" selectedRowKeys="#{pageFlowScope.selectedKeys}"
value="#{loginPageBean.menu}" var="node"
rowSelection="single" autoHeightRows="-1">
<f:facet name="nodeStamp">
<af:group id="_pt_g1">
<af:commandLink text="#{node.menuDesc}" id="_cl1"
inlineStyle="font-weight:bold;"
action="#{loginPageBean.menuAction}"
rendered="#{node.navigationFlow ne '-'}"
immediate="true"
partialSubmit="true">
<af:setActionListener from="#{node.parentId}"
to="#{loginPageBean.menuCode}"/>
<af:setActionListener from="#{node.navigationFlow}"
to="#{loginPageBean.navigationFlow}"/>
<af:setActionListener from="#{node.cmbType}"
to="#{loginPageBean.cmbType}"/>
<af:setActionListener from="#{node.crTag}"
to="#{loginPageBean.crTag}"/>
</af:commandLink>
<af:outputText value="menuDesc" id="ot1" // on selecting this output text, the children should expand.
rendered="#{node.navigationFlow eq '-'}"
inlineStyle="font-weight:bold;"></af:outputText>
</af:group>
</f:facet>
<af:clientListener method="expandDiscloseNode1" type="click"/>
</af:tree>
Thanks,
Gopi