0

我正在尝试使用primefaces Tree(和TreeTable,这会更好,但结果是一样的)显示值

<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" />
        </p:treeNode>
    </p:tree>
</h:form>

按下 commandButton 时,没有任何反应。移除组件时,支持 bean 方法被正确调用。

你知道为什么吗 ?如何使用“树状”组件显示数据,同时能够在将数据发送回支持 bean 之前与数据进行交互?

谢谢

4

1 回答 1

0

正如 Ömer Faruk Almalı 所说

将按钮设置为其他形式使事情起作用。至于解释,我让你解释:)

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

<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" />
            </f:facet>

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

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

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

            <p:column headerText="Distance">
                <p:inputText value="#{perfo.distance}"
                    rendered="#{perfo.distance != null}">
                    <p:ajax event="blur" listener="#{aircraftTypeHandler.tableSubmit}" />
                </p:inputText>
            </p:column>
        </p:treeTable>
</h:form>
于 2013-05-05T19:33:27.777 回答