datatable without header

Locked
marcelocaser
Posts: 122
Joined: 13 Dec 2011, 15:07

07 Jan 2016, 19:02

Hi,

I need <p:dataTable /> without header. What is the easy way to do this ?

thank you

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

07 Jan 2016, 23:33

Which header? the column header of Datatable ??

marcelocaser
Posts: 122
Joined: 13 Dec 2011, 15:07

08 Jan 2016, 03:30

Yess, column header!! I need not show!!

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

08 Jan 2016, 16:55

Please try with;

For only one datatable;

Code: Select all

.noHeader.ui-datatable table thead tr {
    display: none;
}

<p:dataTable styleClass="noHeader" ..>
For all Datatable;

Code: Select all

.ui-datatable table thead tr {
    display: none;
}

marcelocaser
Posts: 122
Joined: 13 Dec 2011, 15:07

08 Jan 2016, 19:05

Hi,

I created new css file and put the above code , but it worked . No changes.

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

10 Jan 2016, 13:49

I tested this issue with my css code. it works fine. Please check your style on firebug of the browser.
My test code (in datatable.xhtml);

Code: Select all

<p:dataTable styleClass="noHeader" id="singleDT" var="car" value="#{dtSelectionView.cars7}" selectionMode="single" selection="#{dtSelectionView.selectedCar}" rowKey="#{car.id}"
             rows="10" paginator="true" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
             rowsPerPageTemplate="5,10,15" emptyMessage="No cars found with given criteria" reflow="true">

    <p:column headerText="Id" sortBy="#{car.id}">
        <h:outputText value="#{car.id}" />
    </p:column>
    <p:column headerText="Year" sortBy="#{car.year}">
        <h:outputText value="#{car.year}" />
    </p:column>
    <p:column headerText="Brand" sortBy="#{car.brand}">
        <h:outputText value="#{car.brand}" />
    </p:column>
    <p:column headerText="Color" sortBy="#{car.color}">
        <h:outputText value="#{car.color}" />
    </p:column>
</p:dataTable>
My css code(test.css);

Code: Select all

.noHeader.ui-datatable table thead tr {
    display: none;
}
My Screenshot;
Image

marcelocaser
Posts: 122
Joined: 13 Dec 2011, 15:07

11 Jan 2016, 15:01

Ok. It worked.

Thank you again!

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

11 Jan 2016, 16:09

Glad to hear, thanks !

Locked

Return to “Adamantium”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests