1

I have a form with a selectOneMenu and when I select the third "Visualizar todos los archivos" I want to render a <t:tree2>. All this is using Ajax to render the component when the value changes in the selectOneMenu.

What's happening is that only gets rendered the very first node of the tree, and when I click on the + sign next to the folder it does not expand at all.

This is my code:

    <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>

What am I missing?

Thanks in advance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
BRabbit27
  • 6,333
  • 17
  • 90
  • 161

1 Answers1

1

You have typos in the code. Note the rendered attribute of the following components:

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

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

It should have been:

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

<t:graphicImage value="images/folderClose.png"
                rendered="#{t.nodeExpanded}"
                border="0" />
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555