PrimeFaces TreeTable no responde al envío del formulario

I'm trying to display values using primefaces Tree (and TreeTable, which would even be better, but the result is the same)

<h:form id="treeTableForm">
    <p:commandButton actionListener="#{aircraftTypeHandler.tableSubmit}"
        update="@form" />
    <p:tree id="perfoTree" value="#{aircraftTypeHandler.perfosNode}"
        var="perfo" animate="true" style="min-width:300px;">
        <p:treeNode id="treeNode">
            <h:inputText value="#{perfo.type}" />
            <p:spacer width="20" height="0" />
            <h:inputText value="#{perfo.altitude}" />
            <p:spacer width="20" height="0" />
            <h:inputText value="#{perfo.mass}" />
            <p:spacer width="20" height="0" />
            <h:inputText value="#{perfo.distance}" />
            <p:spacer width="20" height="0" />

When pressing the commandButton, nothing happens. When removing the component, the backing bean method is correctly called.

Do you know why ? How can I display data using "tree-like" components, and at the same time be able to interact with the data before sending it back to the backing bean ?


preguntado el 05 de mayo de 13 a las 15:05

Maybe you can try to put your button outside of the form. -

What do you mean by 'nothing happens'? The AJAX request isn't sent? What exactly malfunctions in accordance with your expectations? Elaborate on it in a more developer-friendly way. -

By the way, roughly the same setup can be found in Escaparate de PrimeFaces, which is working as expected. -

The tree (or child elements) is probably causing validation/conversion to fail. Check your browser's developer console to check for warnings or place a <h:messages/> component on your page to catch errors -

@kolossus : I put a <h:messages/ in my form but nothing is displayed when I press the button. -

1 Respuestas

As indicated by Ömer Faruk Almalı

Putting the button in an other form made the thing work. As for the explanation, I let you explain :)

    <p:commandButton id="singleBtn" value="Save" icon="ui-icon-save"
            update="@form :treeTableForm" process="@form :treeTableForm"
            actionListener="#{aircraftTypeHandler.tableSubmit}" />

<h:form id="treeTableForm">
        <p:treeTable id="perfosTreeTable"
            value="#{aircraftTypeHandler.perfosNode}" var="perfo"
            scrollable="true" scrollHeight="300">

            <f:facet name="header">
                <h:outputText value="Performances" />

            <p:column headerText="Perfo Type">
                <h:outputText value="#{perfo.type}" />

            <p:column headerText="Altitude">
                <h:outputText value="#{perfo.altitude}" />

            <p:column headerText="Mass">
                <h:outputText value="#{perfo.mass}" />

            <p:column headerText="Distance">
                <p:inputText value="#{perfo.distance}"
                    rendered="#{perfo.distance != null}">
                    <p:ajax event="blur" listener="#{aircraftTypeHandler.tableSubmit}" />

contestado el 05 de mayo de 13 a las 20:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.