3

I have a datatable in Primefaces:

    <p:dataTable var="feedback" value="#{actionDetailsView.action.feedback}">
                <f:facet name="header">
                    Feedback
                </f:facet>

                <p:column headerText="Date">
                    ...
                </p:column>

Now I want to have a button (Add Feedback) inside the header on the right hand side. Is this somehow possible?

matthias
  • 1,938
  • 23
  • 51
  • Why not **try** to put a button in the header and ask afterwards if it e.g. does not work or whatever... (now it kind of looks like you are 'lazy' which I assume you are not. And the 'official' answer to your question _"Is this somehow possible?"_ would be a **yes**, nothing more. And accepting a good answer is common practice in stackoverflow. Please do – Kukeltje Oct 25 '16 at 08:43

1 Answers1

7

Yes, it is. You may define the button as a child of the f:facet tag.

<p:dataTable>
    <f:facet name="header">
        <p:commandButton /> <!-- either here -->
    </f:facet>

    <p:column>
        <f:facet name="header">
            <p:commandButton /> <!-- or here -->
        </f:facet>
    </p:column>
</p:datatable>
stg
  • 2,757
  • 2
  • 28
  • 55