Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

after filtering Empty rows blank rows displayed while paging in the datatable using Primefaces

I have problem with datatable using Primefaces 2.2.1 and JSF 2.0.

I have used filtering and paging in the datatable. When I try to filter the selected data is displayed and when i remove the filter the entire data is displayed. But after this when i try to use paging then suddendly all the rows becomes blank(empty) See screenshot below

enter image description here

enter image description here

enter image description here

Any suggestions. Please help.

.xhtml file

<p:dataTable var="user" value="#{userManagedBean.searchUsersResults}"
        selection="#{userManagedBean.selectedUser}" selectionMode="single"
        dynamic="true"
        onRowSelectUpdate="userUpdateForm"
        onRowUnselectUpdate="userUpdateForm"
        rowSelectListener="#{userManagedBean.onUserSelect}"
        rowUnselectListener="#{userManagedBean.onUserUnselect}"
        paginator="true" rows="10" style="width: 70% ">
        <p:column sortBy="#{user.userId}" filterBy="#{user.userId}" >
            <f:facet name="header">
            <h:outputText value="Id" />
            </f:facet>
            <h:outputText value="#{user.userId}" />
            </p:column>
            <p:column sortBy="#{user.username}" filterBy="#{user.username}">
            <f:facet name="header">
            <h:outputText value="Name" />
            </f:facet>
            <h:outputText value="#{user.username}" />
            </p:column>
            <p:column sortBy="#{user.emailId}" filterBy="#{user.emailId}">
            <f:facet name="header">
            <h:outputText value="Email" />
            </f:facet>
            <h:outputText value="#{user.emailId}" />
            </p:column>
            <p:column sortBy="#{user.dob}" filterBy="#{user.dob}">
            <f:facet name="header">
            <h:outputText value="DOB" />
            </f:facet>
            <h:outputText value="#{user.dob}" >
                <f:convertDateTime pattern="MM/dd/yyyy" />
            </h:outputText>
        </p:column>
    </p:dataTable>
    <p:panel id="userDetailsPanelId" header="Users Details" style="width:60%;">
    <h:panelGrid columns="2" cellpadding="2" id="userUpdateForm" border="0" >
            <h:outputLabel for="#{userManagedBean.selectedUser.userId}" value="UserId"/>
            <h:inputText value="#{userManagedBean.selectedUser.userId}" style="width: 100%;" readonly="true"></h:inputText>

            <h:outputLabel for="#{userManagedBean.selectedUser.username}" value="Username"/>
            <h:inputText value="#{userManagedBean.selectedUser.username}" readonly="true"></h:inputText>

            <h:outputLabel for="#{userManagedBean.selectedUser.emailId}" value="EmailId"/>
            <h:inputText value="#{userManagedBean.selectedUser.emailId}" readonly="true"></h:inputText>

            <h:outputLabel for="#{userManagedBean.selectedUser.gender}" value="Gender"/>
            <h:inputText value="#{userManagedBean.selectedUser.gender}" readonly="true"></h:inputText>

            <h:outputLabel for="#{userManagedBean.selectedUser.dob}" value="DOB"/>
            <h:inputText value="#{userManagedBean.selectedUser.dob}" readonly="true">
                <f:convertDateTime pattern="MM/dd/yyyy" />
            </h:inputText>

        </h:panelGrid>
        </p:panel>
    </h:form>
    </center>

like image 569
user617966 Avatar asked Feb 18 '11 14:02

user617966


1 Answers

I encountered the same problem and eventually discovered it was caused by my value object (in this case your user object) not implementing Serializable.

like image 104
Royceston Avatar answered Oct 21 '22 08:10

Royceston