1

我有一个带有 a 的表单,selectOneMenu当我选择第三个“Visualizar todos los archivos”时,我想渲染一个<t:tree2>. 这一切都是使用 Ajax 在selectOneMenu.

发生的事情是只渲染树的第一个节点,当我单击+文件夹旁边的标志时,它根本不会展开。

这是我的代码:

    <h:form id="menuForm" enctype="multipart/form-data">
        <h:outputLabel for="option" value="Acciones disponibles: " />
        <h:selectOneMenu id="option"
                         value="#{uploadFile.option}">
            <f:selectItem itemLabel="Seleccione una opción..." itemValue="null" />
            <f:selectItems value="#{uploadFile.options}" />
            <f:ajax render="@form" execute="@form" />
        </h:selectOneMenu>

        <h:panelGrid id="dataLoad" columns ="3" 
                     rendered="#{uploadFile.option == 'Cargar información completa.' || 
                                 uploadFile.option == 'Cargar solo información errónea.'}">
            <h:outputLabel for="upfile" value="Archivo: " />
            <t:inputFileUpload id="upfile" 
                               value="#{uploadFile.upFile}" />
            <h:panelGroup/>
            <h:panelGroup/>
            <h:commandButton value="Continuar"
                             onclick="return confirmation()"
                             action="#{uploadFile.upload}" />
        </h:panelGrid>

        <h:panelGrid id="listFiles" columns="3"
                     rendered="#{uploadFile.option == 'Visualizar todos los archivos.'}">
            <t:tree2 id="tree" value="#{listFiles.treeRoot}"
                     var="node" varNodeToggler="t" >
                <f:facet name="folder">
                    <h:panelGroup>
                        <f:facet name="expand">
                            <t:graphicImage value="images/folderOpen.png"
                                            rendered="#{t.nodeExpanded}}"
                                            border="0" />
                        </f:facet>
                        <f:facet name="collapse">
                            <t:graphicImage value="images/folderClose.png"
                                            rendere="#{t.nodeExpanded}}"
                                            border="0" />
                        </f:facet>
                        <h:outputText value="#{node.description}"
                                      styleClass="nodeFolder" />
                    </h:panelGroup>
                </f:facet>
                <f:facet name="file">
                    <h:panelGroup>
                        <h:commandLink action="#{listFiles.download(node.identifier)}">
                            <t:graphicImage value="images/file.png" border="0" />
                            <h:outputText value="#{node.description}" />
                        </h:commandLink>
                    </h:panelGroup>
                </f:facet>
            </t:tree2>
        </h:panelGrid>
    </h:form>

我错过了什么?

提前致谢。

4

1 回答 1

1

您的代码中有拼写错误。请注意rendered以下组件的属性:

<t:graphicImage value="images/folderOpen.png"
                rendered="#{t.nodeExpanded}}"
                border="0" />

<t:graphicImage value="images/folderClose.png"
                rendere="#{t.nodeExpanded}}"
                border="0" />

它应该是:

<t:graphicImage value="images/folderOpen.png"
                rendered="#{t.nodeExpanded}"
                border="0" />

<t:graphicImage value="images/folderClose.png"
                rendered="#{t.nodeExpanded}"
                border="0" />
于 2011-11-15T17:03:18.707 回答