Note that there are some explanatory texts on larger screens.

plurals
  1. POPrimefaces Datatable within Tabview - initial sort on second tab doesnt work
    text
    copied!<p>I have a tabView where each tab contains a datatable. I have it set up like so</p> <pre><code>&lt;p:tabView id="tabView" styleClass="manage-tab-view" prependId="false" activeIndex="#{managementTabBean.activeIndex}" dynamic="true" cache="false"&gt; &lt;p:tab id="users" title="#{msg['TeamManagement.Tabs.Users']}" &gt; &lt;ui:include src="tab1.xhtml" /&gt; &lt;/p:tab&gt; &lt;p:tab id="athletes" title="#{msg['TeamManagement.Tabs.Athletes']}"&gt; &lt;ui:include src="tab2.xhtml" /&gt; &lt;/p:tab&gt; &lt;/p:tabView&gt; </code></pre> <p>Within each tab I am trying to show a datatable. Right now I have it set up like this:</p> <p>Tab1:</p> <pre><code>&lt;h:form id="userProfileViewForm" prependId="false"&gt; &lt;p:dataTable var="userProfile" value="#{userProfileListBean.objects}" id="userProfilesTable" sortBy = "#{userProfile.lastName}" sortFunction = "#{userProfileListBean.sortUserLastName}" sortOrder = "ascending" lazy="true"&gt; &lt;p:column sortBy="#{userProfile.lastName}" sortFunction = "#{userProfileListBean.sortUserLastName}" id="userName"&gt; p:commandLink&gt; &lt;p:commandLink rendered="#{!appContextBean.isCWContext()}" onclick="window.location.href='userBS.xhtml?id=#{userProfile.id}'"&gt; &lt;div class="clickable-cell"&gt; &lt;h:outputText value="#{userProfile.firstName} #{userProfile.lastName}" /&gt; &lt;/div&gt; &lt;/p:commandLink&gt; &lt;/p:column&gt; ...more columns... </code></pre> <p>Tab2: Similar DataTable</p> <pre><code>&lt;p:dataTable var="athlete" value="#{athleteListBean.objects}" tableStyle="width:auto" sortBy="#{athlete.getDisplayName()}" sortFunction = "#{athleteListBean.sortAthleteDisplayName}" id="athletesTable" sortOrder="#{athleteListBean.getListSortOrderDesc()}" lazy="true" paginator="true" rows="15" paginatorPosition="bottom" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"&gt; &lt;p:column sortBy="#{athlete.getDisplayName()}" sortFunction = "#{athleteListBean.sortAthleteDisplayName}" id="athleteColumn"&gt; &lt;h:outputText styleClass="athlete-listing athlete-name" value="#{athlete.firstInitial} #{athlete.lastName}" /&gt; &lt;/p:column&gt; </code></pre> <p>As you can see I have a custom initial sorting function set up for both datatables. </p> <p>For some reason the first tab sorting function gets called, and the second tab sorting function does not. After I swapped the tabs in the tabview, tab2 sorting function gets called, but tab1 doesnt. </p> <p>Basically <strong>the initial sorting function only gets called on the datatable of the first tab, based on the order of tabs in the tab view</strong>. Can anyone tell me why this is happening?</p> <p>Thank you for your help.</p>
 

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