Display only data (no headers) in p:dataTable

UI Components for JSF
Post Reply
nirvanbd
Posts: 45
Joined: 16 Oct 2010, 16:17

09 Dec 2010, 13:45

Is it possible for a p:dataTable to display only data (with no headers). When there is no data, the dataTable should display nothing on the webpage, and when there is some data, it should display only the data (without header).

regards,
Nirvan.

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

09 Dec 2010, 15:54

You can use the rendered attribute of the dataTabe to conditionally hide the dataTable if your entity collection is empty.

Franke
Posts: 49
Joined: 12 Oct 2010, 08:41

09 Dec 2010, 17:31

You could simply use h:datatable instead if you don't need any special functions only available in primefaces.
Using PF 3.0 with default JSF implementation of JBoss 6

User avatar
Daedalus
Posts: 164
Joined: 28 Jan 2010, 12:03

09 Dec 2010, 17:54

The solution is very simple. The header is a simple div with a styleClass.

The styleClass is named "ui-datatable-header" for a normal dataTable or "ui-scrollable-datatable-header" if the table is scrollable.

So just overwrite the corresponding css class:

ui-datatable-header{
display:"none";
}
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,

nirvanbd
Posts: 45
Joined: 16 Oct 2010, 16:17

10 Dec 2010, 06:11

Daedalus,
I used your solution and got rid of the main header. However, the column headers still appear.

regards,
Nirvan.

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

13 Jan 2011, 20:56

Nirvan
Did you eventually get a solution for this?
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

14 Jan 2011, 00:04

I do this by not having any column headers, i.e. no headerText= and
p:dataTable styleClass="noheader", with this in the css:

Code: Select all

.noheader.ui-datatable table thead {
    display: none;
}
no doubt this is one of a myriad of ways of doing this! With the following
css selectors using p:dataTable styleClass="noborder" all borders are
entirely removed which is quite an interesting effect:

Code: Select all

.noborder.ui-datatable table {
    border: 0 hidden;
    border-collapse: separate;
}

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

.noborder.ui-datatable tr {
    border: 0 transparent;
    background: transparent none;
}

.ui-datatable .ui-datatable-data tr.ui-state-highlight {
    background: #dfdfdf;
}

.ui-datatable .ui-datatable-data tr.ui-state-highlight.ui-selected {
    background: #c6deff;
}
I did try .ui-datatable-header but that didn't quite seem to work for me.

Regards,
Brendan.

remya.jacobn
Posts: 15
Joined: 22 Sep 2016, 04:32

25 Oct 2016, 02:44

I also have a requirement to not display the column headers for p-dataTable.
I have tried the solution using style class as below.

Code: Select all

<p-dataTable  [value]="newReleaseList"  [editable]="true" emptyMessage="" styleClass="noHeader">
....
in the component's css i have updated the below style class.

Code: Select all

.noHeader .ui-datatable table thead  {
    display: none !important;
}
This does not seem to work for me.
I have tried the id approach as well, but all options that I try, it is not able to reference the ui-datatable div inside the p-dataTable.

Any help appreciated.
Regards,
RJ
PrimeNG: 7.1.0
Ultima: 7.0.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

25 Oct 2016, 18:18

You are posting in the wrong forum. You use prime-ng, not PrimeFaces

dannycrane
Posts: 1
Joined: 27 Oct 2016, 16:16

27 Oct 2016, 16:26

I really benefit from reading content form this site. I must admit that I'm particularly impressed by how the members of this forum share very helpful solutions. Expert Research Paper Writers

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Analytics-24 and 34 guests