Note that there are some explanatory texts on larger screens.

plurals
  1. POPaginated Primefaces dataTable leaves out first result on initial loading
    primarykey
    data
    text
    <p>I'm not sure why this is happening, and I've never encountered this before either. On the application I'm working on, I use a to display certain travel data. The user chooses certain information about the trip (from/to/dates etc..), and then when clicking search, the dataTable is loaded up with the results.</p> <p>The issue: when the dataTable loads, it seems to leave out 1 (or more) results. When refreshing the page, the missing result somehow displays this time, as seen by the size of the table changing. However, clicking on the "Export to Excel" function below the table (built in from PF) already shows this missing row, with or without the refresh. This seems to indicate that it might be some sort of UI issue?</p> <p>Any help is appreciated, thanks! Also, let me know if you need any additional details.</p> <p>Sanjeev</p> <p>EDIT: The code for the primefaces datatable is below:</p> <pre><code>&lt;p:dataTable id="#{viewName}Table" value="#{resultsBean.legs}" var="leg" paginator="true" rows="20"&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Traveler Name &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.lastName}, #{leg.trip.firstName}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Email Address &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.email}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Mobile Phone &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.mobilePhoneNumber}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; PNR Locator &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.recordLocator}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Travel Type &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.type}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Departure / Check-In Date &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.fromDate}"&gt; &lt;f:convertDateTime pattern="dd-MMM-yyyy HH:mm"/&gt; &lt;/h:outputText&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Arrival / Check-Out Date &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.toDate}"&gt; &lt;f:convertDateTime pattern="dd-MMM-yyyy HH:mm"/&gt; &lt;/h:outputText&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; From Location &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.fromLocation.id == 0 ? '' : leg.fromLocation.locationName}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; To Location &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.toLocation.id == 0 ? '' : leg.toLocation.locationName}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; From Code &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.fromCode}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; To Code &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.toCode}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Airline / Hotel Name &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.carrierName}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Flight / Rail # &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.carrierVehicleCode}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; CMC &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.cmc.name}"/&gt; &lt;/p:column&gt; &lt;p:column style="white-space: normal"&gt; &lt;f:facet name="header"&gt; Booking Country &lt;/f:facet&gt; &lt;h:outputText style="white-space: nowrap" value="#{leg.trip.cmc.location.locationName}"/&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; </code></pre> <p>It looks like for some reason, only the first result is getting cut off. If there's only one page on the table, then refreshing the screen will show the missing result. If there's multiple pages, then going to the next page and coming back to the first page will do the trick also.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload