primefaces数据表显示空白行。显示与支持列表中的记录相同的行数

时间:2015-01-08 09:56:40

标签: primefaces datatable

感谢所有回应开发人员问题的人。

我在数据表中遇到了关于primefaces 5.0的问题。

我有一个数据表,其中有14条记录像往常一样由列表支持。它工作正常,直到我将spring添加到我的JSF应用程序中。

数据表中支持的

列表是通过一种将值设置到列表中的方法从数据库获取数据(不是用getter方法填充数据)。

现在当我检查列表的getter时,列表中有14条记录。问题是数据表没有显示这些记录的值。它显示空白行。它显示了14个空白记录。

如果我正在尝试打印列表记录的值,则打印正常。 我试图看到列表的记录类型也是所需的类型。

如果我将尝试打印数据表之外的列表记录字段的特定值,该数据表也在xhtml页面中打印正常,但它没有在数据表中显示相同的内容。

我没有更改任何sysntex,因为它在添加spring之前工作正常。

请帮帮我。感谢大家。我正在展示下面的xhtml代码。

<p:dataTable id="datatable" var="variable" value="#{myClass.existingRecordList}" resizableColumns="true" 
	paginator="true" rows="10" editable="true" style="font-size:12px" paginatorAlwaysVisible="true"
	paginatorPosition="top" rowIndexVar="rowIndex" rowsPerPageTemplate="5,10,15,20"
	paginatorTemplate="Displaying {RowsPerPageDropdown} records / page {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport}"
	currentPageReportTemplate="{startRecord} - {endRecord} of {totalRecords}" >
	<p:columnGroup type="header" >
		<p:row>
			<p:column headerText="#" style="text-align:center;white-space:normal;width:25px"/>
			<p:column headerText="Field1" style="text-align:center;white-space:normal;width:50px;vertical-align:bottom"
				sortBy="#{variable.field1}" filterBy="#{variable.field1}" filterMatchMode="contains" rendered="#{otherClass.field1}" />
			<p:column headerText="Field2" style="text-align:center;white-space:normal;width:50px;vertical-align:bottom"
				sortBy="#{variable.field2}" filterBy="#{variable.field2}" filterMatchMode="contains" rendered="#{otherClass.field2}"/>
			<p:column headerText="Field3" style="text-align:center;white-space:normal;width:50px;vertical-align:bottom"
				sortBy="#{variable.field3}" filterBy="#{variable.field3}" filterMatchMode="contains" rendered="#{otherClass.field3}"/>
		</p:row>
	</p:columnGroup> 
	<p:column headerText="#" style="text-align:center;white-space:normal;width:20px" exportable="false">
		<h:outputText value="#{rowIndex+1}" style="text-align:center"/> <!-- This is printing the value -->
	</p:column>
	<p:column headerText="Field1" style="text-align:center;" rendered="#{otherClass.field1}">
		<h:outputText value="#{variable.field1}" style="text-align:center;white-space:normal"/><!-- This is not printing the value showing blank-->
	</p:column>
	<p:column headerText="Field2" style="text-align:center;" rendered="#{otherClass.field2}">
		<h:outputText value="#{variable.field2}"/> <!-- This is not printing the value showing blank-->
	</p:column>
	<p:column headerText="Field3" style="text-align:center;" rendered="#{otherClass.field3}"> 
		<h:outputText value="#{variable.field3}"/> <!-- This is not printing the value showing blank-->
	</p:column>
</p:dataTable>
<h:outputText value="This is the value #{myClass.existingRecordList.get(0).field1}"></h:outputText> <!-- This is printing the value -->

0 个答案:

没有答案