primefaces datatable is showing blank rows. Showing the same number of rows as the records in backed list

谁都会走 提交于 2020-01-14 18:55:40

问题


Thanks to all those who are responding to the problems of the developers.

I am facing some issue with primefaces 5.0 in datatable.

i am having one datatable with 14 records into that backed by list as usual. It was working fine till the time i added spring into my JSF application.

list backed in datatable is getting data from database though one method which is setting the values into the list(not filling data in getter method).

now when i am checking in getter of the list, it is having 14 records into the list. The problem is datatable is not showing the values for those records. It is showing blank rows for that. It is showing 14 blank records for that.

if i am trying to print the value of the records of list it is printing fine. i tried to see the type of the records of the list that is also the desired type.

if i will try to print the perticular value of the field of the record of the list outside of the datatable that is also printing fine in xhtml page but it is not showing the same into the datatable.

i didn't change any sysntex as it was working fine before adding spring into it.

please help me for this. Thanks to all of you. I am showing the xhtml code below.

<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 -->

来源:https://stackoverflow.com/questions/27837263/primefaces-datatable-is-showing-blank-rows-showing-the-same-number-of-rows-as-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!