0

我正在尝试使用单元格编辑创建 PrimeFaces p:dataTable。也许我使用了错误的语法或错误的绑定?带有数据表的 Html 代码:

    <p:dataTable editable="true" editMode="cell" id="temperatureTable"
        value="#{firingBean.temperatureMap}" var="temperatureRow" widgetVar="table">
        <f:facet name="header">  
            Температурная карта
        </f:facet>
        <p:column styleClass="notEditable ui-state-default" width="30">
            <f:facet name="header">
                <h:outputText value="" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{dataSheet.rowIndex + 1}" />
            </f:facet>
        </p:column>
        <p:column styleClass="notEditable" width="50">
            <f:facet name="header">
                <h:outputText value="#{msg['firing.timefromstart']}" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.hoursAfterStart}" />
            </f:facet>
        </p:column>
        <p:column width="75">
            <f:facet name="header">
                <h:outputText value="Термопара 1" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[0].value}" width="75"/>
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[0].value}" style="width:75px">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet> 
        </p:column>
        <p:column width="75" rendered="#{firingBean.thermoPairs > 1}">
            <f:facet name="header">
                <h:outputText value="Термопара 2" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[1].value}" />
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[1].value}" 
                    style="width:75px" styleClass="inputMega">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet>
        </p:column>
        <p:column width="75" rendered="#{firingBean.thermoPairs > 2}">
            <f:facet name="header">
                <h:outputText value="Термопара 3" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[2].value}" />
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[2].value}" style="width:75px">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet>
        </p:column>
        <p:column width="75" rendered="#{firingBean.thermoPairs > 3}">
            <f:facet name="header">
                <h:outputText value="Термопара 4" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[3].value}" />
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[3].value}" style="width:75px">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet>
        </p:column>
        <p:column width="75" rendered="#{firingBean.thermoPairs > 4}">
            <f:facet name="header">
                <h:outputText value="Термопара 5" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[4].value}" />
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[4].value}" style="width:75px">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet>
        </p:column>
        <p:column width="75" rendered="#{firingBean.thermoPairs > 5}">
            <f:facet name="header">
                <h:outputText value="Термопара 6" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.points[5].value}" />
            </f:facet>
            <f:facet name="input">
                <h:inputText required="true" value="#{temperatureRow.points[5].value}" style="width:75px">
                    <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
                    <f:validateDoubleRange maximum="99999999999999" />
                </h:inputText>
            </f:facet>
        </p:column>
        <p:column styleClass="notEditable"  width="75">
            <f:facet name="header">
                <h:outputText value="#{msg['firing.source']}" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.measureSource}" />
            </f:facet>
        </p:column>
        <p:column styleClass="notEditable" width="75">
            <f:facet name="header">
                <h:outputText value="#{msg['firing.user']}" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.modificationUser}" />
            </f:facet>
        </p:column>
        <p:column styleClass="notEditable" width="75">
            <f:facet name="header">
                <h:outputText value="#{msg['firing.date']}" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.modificationDate}">
                    <f:converter converterId="util-to-sql-date-converter" />
                </h:outputText>
            </f:facet>
        </p:column>
        <p:column width="75">
            <f:facet name="header">
                <h:outputText value="#{msg['firing.note']}" />
            </f:facet>
            <f:facet name="output">
                <h:outputText value="#{temperatureRow.note}" style="width:75px"/>
            </f:facet>
            <f:facet name="input">
                <h:inputText value="#{temperatureRow.note}" style="width:75px">
                <p:ajax event="change" listener="#{firingBean.updateUserDate}" />
            </h:inputText>
            </f:facet>
        </p:column>
    </p:dataTable>

但是表格重新渲染了空行,而单元格和错误中没有可见值。怎么了?我正在使用 PrimeFaces 4.0。

数据表错误

4

1 回答 1

1
<p:column styleClass="notEditable ui-state-default" width="30">
 <p:cellEditor>
    <f:facet name="input">
            <h:outputText value="" />
        </f:facet>
        <f:facet name="output">
            <h:outputText value="#{dataSheet.rowIndex + 1}" />
        </f:facet>
  </<p:cellEditor>
</p:column>

您没有使用p:cellEditor空白数据表的原因 请 点击链接

于 2013-10-11T10:29:24.803 回答