如何扩展rich:treeNode

时间:2015-06-23 05:55:02

标签: richfaces

我想基于rootNode数据类型中的属性扩展一些树节点。 我在rich:treeNode中尝试使用值“#{true}”进行“扩展”和“扩展”,但它们似乎没有效果。

<rich:tree id="tree" ajaxSubmitSelection="true" switchType="ajax" styleClass="expand-img-custom" 
                        value="#{ruleDefBackingBean.rootNode}" var="node" showConnectingLines="true">
                        <rich:treeNode id="node#{node.nodeText}" >
                            <h:selectBooleanCheckbox styleClass="varChkBox" value="#{node.selected}">
                                <a4j:support event="onclick" actionListener="#{ruleDefBackingBean.selectNode}"  reRender="node#{node.nodeText}" />
                            </h:selectBooleanCheckbox>

                            <h:outputText value="#{node.nodeText}" rendered = "#{node.nodeId eq node.categoryId and node.parentNode eq 'true'}" styleClass="legend textBold" style="display:inline;">
                                <span class="dynatree-icon rule-tree-parent-img" ></span>   
                            </h:outputText>
                            <h:outputText value="#{node.nodeText}" rendered = "#{node.nodeId ne node.categoryId or  node.parentNode ne 'true'}"  styleClass="textNormal legend" style="display:inline;">
                                <span class="dynatree-icon rule-tree-child-img" ></span>    
                            </h:outputText>

                        </rich:treeNode>
                    </rich:tree>

应该怎样做才能使它发挥作用?

1 个答案:

答案 0 :(得分:1)

使用 adviseNodeOpened

        'Get me all filenames with file extension .xlsx
        Dim fileNames() As String = System.IO.Directory.GetFiles("C:\Users\Administrator\Desktop\Excel Files\")

        'Loop through array of filenames
        For Each fileName As String In fileNames

            'Other excel code here

            objExcel.Workbooks.Open(fileName)
        Next

*。java的

 <rich:tree id="tree" ajaxSubmitSelection="true" switchType="ajax" styleClass="expand-img-custom" 
    value="#{ruleDefBackingBean.rootNode}" var="node" showConnectingLines="true" adviseNodeOpened="#{ruleDefBackingBean.adviseNodeOpened}">
    <rich:treeNode id="node#{node.nodeText}" changeExpandListener="#{ruleDefBackingBean.setDisableAdviseNodeOpened}">
        <h:selectBooleanCheckbox styleClass="varChkBox" value="#{node.selected}">
            <a4j:support event="onclick" actionListener="#{ruleDefBackingBean.selectNode}"  reRender="node#{node.nodeText}" />
        </h:selectBooleanCheckbox>

        <h:outputText value="#{node.nodeText}" rendered = "#{node.nodeId eq node.categoryId and node.parentNode eq 'true'}" styleClass="legend textBold" style="display:inline;">
            <span class="dynatree-icon rule-tree-parent-img" ></span>   
        </h:outputText>
        <h:outputText value="#{node.nodeText}" rendered = "#{node.nodeId ne node.categoryId or  node.parentNode ne 'true'}"  styleClass="textNormal legend" style="display:inline;">
            <span class="dynatree-icon rule-tree-child-img" ></span>    
        </h:outputText>
    </rich:treeNode>
</rich:tree>