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.
Display only data (no headers) in p:dataTable
- bumble.bee
- Posts: 723
- Joined: 29 Sep 2010, 21:39
- Location: United States
You can use the rendered attribute of the dataTabe to conditionally hide the dataTable if your entity collection is empty.
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";
}
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,
Nirvan
Did you eventually get a solution for this?
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
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit
I do this by not having any column headers, i.e. no headerText= and
p:dataTable styleClass="noheader", with this in the css:
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:
I did try .ui-datatable-header but that didn't quite seem to work for me.
Regards,
Brendan.
p:dataTable styleClass="noheader", with this in the css:
Code: Select all
.noheader.ui-datatable table thead {
display: none;
}
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;
}
Regards,
Brendan.
-
- Posts: 15
- Joined: 22 Sep 2016, 04:32
I also have a requirement to not display the column headers for p-dataTable.
I have tried the solution using style class as below.
in the component's css i have updated the below style class.
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.
I have tried the solution using style class as below.
Code: Select all
<p-dataTable [value]="newReleaseList" [editable]="true" emptyMessage="" styleClass="noHeader">
....
Code: Select all
.noHeader .ui-datatable table thead {
display: none !important;
}
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
RJ
PrimeNG: 7.1.0
Ultima: 7.0.1
-
- Posts: 1
- Joined: 27 Oct 2016, 16:16
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