Reputation: 97
I have primefaces datatable with defined paginator template and toolbar in <f:facet name="header">
example:
<p:dataTable paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{startRecord} - {endRecord} of {totalRecords}">
<f:facet name="header">
<p:selectOneMenu id="presetSelectOneMenu"
value="#{alarmTable.selectedGuiPreset}"
style="padding: 0; margin: 0;float: left; display: block; width: 100px; text-align: left;">
<f:selectItem itemLabel="Global" itemValue="" itemDisabled="true" />
<f:selectItems value="#{guiSettings.arrayOfGlobalGuiPresets}" />
<f:selectItem itemLabel="Personal" itemValue="" itemDisabled="true" />
<f:selectItems value="#{guiSettings.arrayOfPersonalGuiPresets}" />
<p:ajax event="change" update="alarmTableId"
listener="#{alarmTable.actionSelectGuiPreset(true)}" />
</p:selectOneMenu>
<p:commandButton id="btnRefreshFilter" icon="ui-icon-refresh"
action="#{alarmTable.actionSelectGuiPreset(true)}"
update="alarmTableId" style="margin-left: 3px; float: left;"
title="Refresh" />
<h:outputText id="selectedGuiPresetText"
style="float: left; font-size: 12px; padding-top: 3px; padding-left: 5px"
value="In use - '#{alarmTable.selectedGuiPresets.size() > 0 ? alarmTable.selectedGuiPresets.get(0).presetName : ''}'" />
</f:facet>
<p:columns>
it's looks like: pic
I want save vertical monitor space and integrate components from<f:facet name="header">
into paginator row.
Is that possible?
Upvotes: 4
Views: 9424
Reputation: 701
It is indeed possible as of PrimeFaces 5.0 (community edition). You are now able to define a custom facet and add its name to the paginatorTemplate
. Like this:
<p:dataTable paginator="true" paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
<f:facet name="{Customization}">
<p:selectOneMenu ... />
<p:commandButton ... />
<h:outputText ... />
</f:facet>
...header
...columns
</p:dataTable>
A demonstration of this feature can be found in the DataExporter showcase.
Regards
Upvotes: 5