PrimeFaces 4.0 p:dataTable不显示行数(空行)

时间:2013-10-11 10:01:12

标签: jsf primefaces

我尝试使用单元格编辑创建PrimeFaces p:dataTable。也许我使用错误的语法或错误的绑定?带有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>

但是表格在单元格和错误中没有可见值的empy行。怎么了? 我使用的是PrimeFaces 4.0。

dataTable Error

1 个答案:

答案 0 :(得分: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 空白数据表的原因 Follow the link