I have a problem with primefaces datatable. As you can see there is an alignment problem with columns border and headers. Is this a primefaces bug or there is something wrong with my datatable? By the way datatable has dynamic columns.
<p:dataTable scrollable="true" scrollWidth="100%" editable="true" editMode="cell"
var="invoiceLine" value="#{myController.invoiceLines}"
selection="#{myController.selectedInvoiceLine}" selectionMode="single" rowKey="#{invoiceLine.uuid}"
>
<p:columns value="#{myController.columns}" var="column"
styleClass="ui-editable-column" width="50"
columnIndexVar="colIndex">
//some stuff
</p:columns>
</p:dataTable>
Do one trick,
Remove scrollable = true
and create new style class like,
.ui-datatable-hor-scroll .ui-datatable-tablewrapper,.scrolling-div .ui-datatable-tablewrapper{
overflow: auto;
width: 100%;
padding-bottom: 5px;}
apply styleClass to p:datatable like styleClass="ui-datatable-hor-scroll"
The problem is still present in 6.2.
Another solution, with width set in style attribute, is to replace
<p:column style="width:100px">
with
<p:column style="width:calc(100px)">
MDN-calc() description
For anyone else who has this problem - Primfaces scrollable continues to have issues. I am on 5.1 and it isn't working.
Just use a normal datatable and then use CSS3 to get the scrolling to work:
https://jsfiddle.net/xuvsncr2/170/
Of course don't use table, thead, tr etc. for targeting elements. Instead use css classes so that you get the right datatable.
The tricky part is that in order to set the size of the scroll pane, you need to target the div directly surrounding the table. You can see how I did this below
Heres more on the flexbox for css3: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Heres an example of the css I used for primefaces. I just wrapped my datatable with a <div class="myCompanyScrollable thirtyEM">
.thirtyEM .ui-datatable-tablewrapper{
height: 30em;
}
.myCompanyScrollable table {
display: flex;
flex-flow: column;
height: 100%;
width: 100%;
}
.myCompanyScrollable table thead {
/* head takes the height it requires,
and it's not scaled when table is resized */
flex: 0 0 auto;
width: calc(100% - 1.05em);
display: table;
table-layout: fixed;
}
.myCompanyScrollable table tbody {
/* body takes all the remaining available space */
flex: 1 1 auto;
display: block;
overflow-y: scroll;
}
.myCompanyScrollable table tbody tr {
width: 100%;
}
.myCompanyScrollable table tbody tr {
display: table;
width: 100%;
table-layout: fixed;
}
/* decorations */
.myCompanyScrollable {
border: 1px solid black;
padding: 0.3em;
}
.myCompanyScrollable table {
border: 1px solid lightgrey;
}
.myCompanyScrollable table td, .myCompanyScrollable table th {
padding: 0.3em;
border: 1px solid lightgrey;
}
.myCompanyScrollable table th {
border: 1px solid grey;
}
This issue is solved in primefaces latest version ( 7.0 )
https://github.com/primefaces/primefaces
Try below jquery code
$('.datatableclassname').find(('div.ui-datatable-scrollable-header ')+'div.ui-dt-c').each(function(index) {
var cur_obj = $(this);
var column_num = parseInt(index+1);
$('.datatableclassname div.ui-datatable-scrollable-body tr > td:nth-child('+column_num+') > div.ui-dt-c').css('width',cur_obj.width()+'px');
});
Related
I'm a newbie to html and css, and I was wondering if this is possible in pure css.
So I made 3 divs, all fitted perfectly to my screen size. What I am wondering is if you make the "Menu" fixed so it scrolls along, can you change the starting position of it?
<div class="red"></div>
<div class="blue">
<h1>Menu</h1>
</div>
<div class="green"></div>
This is the CSS that goes along with it:
.red{
background-color: red;
width: 100%;
height: 1080px;
}
.blue{
background-color: blue;
width: 100%;
height: 1080px;
}
.green{
background-color: green;
width: 100%;
height: 1080px;
}
h1{
font-size: 100px;
position: fixed;
top: 0;
}
So what I basically mean is can "Menu" be fixed from when I scroll across the blue div and downwards while it's not visible yet on the red div? (so the 'starting position' of it is actually on the blue div)
Sorry if the question is poorly explained, english is not my native language. Thank you in advance.
You can just hide "Menu" on red and green divs using z-index.
CSS:
.red{
background-color: red;
width: 100%;
height: 1080px;
z-index:3;
position: relative;
}
.blue{
background-color: blue;
width: 100%;
height: 1080px;
z-index:1;
}
.green{
background-color: green;
width: 100%;
height: 1080px;
z-index:3;
position: relative;
}
h1{
font-size: 100px;
position: fixed;
top: 0;
z-index:2;
}
Example: http://jsfiddle.net/3k3wyscL/
But with this solution problematically would be to add another text visible only on red or green div.
Edit: as you want to see "Menu" on green div too, you can delete green class z-index and position parameters in css.
I know you mentioned you want the solution in pure css, but if you would like to use JQuery that will be a solution.
make the menu absolute:
.persist-menu
{
position: absolute;
}
right a function to update the position of the menu
function UpdateMenuPosition() {
var el = $(".blue"),
offset = el.offset(),
scrollTop = $(window).scrollTop(),
floatingHeader = $(".persist-menu", el)
if (scrollTop > offset.top) {
floatingHeader.css({top:(scrollTop)});
} else {
};
}
and call it while scrolling
$(function() {
$(window)
.scroll(UpdateMenuPosition)
.trigger("scroll");
});
Check the demo: http://jsfiddle.net/wfff74w9/4/
How can I keep icon shown for rich:calendar component?
I need to add another rich:calendar component, but the outputLabel hide the icon.
Code (edited) :
<h:panelGrid columns="4" styleClass="criteresSaisie"
rowClasses="critereLigne"
columnClasses="titreColonne,,titreCourtColonne,">
<h:outputLabel for="dateDeb" value="Période du" />
<rich:calendar id="dateDeb" inputSize="8"
value="#{criteresDecRgltBacking.dtDebDecRglt}"
enableManualInput="true" datePattern="dd/MM/yyyy"
showInput="true" converterMessage="la date de début doit être au format dd/MM/yyyy">
<rich:validator/>
</rich:calendar>
<h:outputLabel for="dateFin" value="au" style="margin-left:20px;"/>
<rich:calendar id="dateFin" inputSize="8"
value="#{criteresDecRgltBacking.dtFinDecRglt}"
enableManualInput="true" datePattern="dd/MM/yyyy"
showInput="true" converterMessage="la date de fin doit être au format dd/MM/yyyy" >
<rich:validator/>
</rich:calendar>
<f:event type="postValidate"
listener="#{rechercheDecRgltCtrl.validationPeriode}" />
</h:panelGrid>
CSS
div.rf-ac-itm {
height: auto !important;
overflow: visible;
}
div.rf-ac-itm-cnt {
height: auto !important;
overflow: visible;
}
.critereLigneAugmente td {
padding-bottom: 0px;
}
.espaceVideCalendar {
width: 10px;
}
.espaceVide {
width: 20px;
}
.espaceColonne {
width: 30px;
}
.titreColonne {
text-align: right;
white-space: nowrap;
width: 180px;
}
.titreCourtColonne {
text-align: right;
white-space: nowrap;
width: 40px;
}
.titreColonne .libelle,.titreColonne label {
padding-right: 10px;
}
.titreColonne .libelle label {
padding-right: 0px;
}
.largeurFixeCriteres{
width: 120px;
overflow: visible;
}
.criteresSaisie {
margin: 10px;
}
.largeurFixeCriteresTiers {
width: 120px;
overflow: visible;
}
.critereLigneAugmente td {
padding-bottom: 0px;
}
.finDeLigne {
width: 0px;
}
The only thing I could see that have a chance to cause problem is the classes order in columnClasses that was "titreColonne,,,titreCourtColonne,," and you changed now to "titreColonne,,titreCourtColonne,".
Previously you where trying to apply a 40px width on a rich:calendar column (titreCourtColonne was on the second rich:calendar column instead of the au column).
I recommand to change this CSS for better styling :
.titreCourtColonne {
text-align: center;
white-space: nowrap;
width: 20px;
}
What code do I add/ replace/ remove to change the size ofmarketbot.net
Are you talking about the global navigation menu or the slider that is on the page? The slider looks like it has a margin problem (in both I.E. 8 and Google Chrome).
I adjusted the css class named content-top to the following, so it isn't overflowing into the header:
.content-top
{
position:relative;
margin-top: 80px;
margin-bottom: 5px;
}
After I made the adjustments, it looks somewhat cleaner in the slider and header divs.
#header {
background: #FFFFFF
width: 100%;
padding: 30px 0px;
position:relative;
margin-top: 80px;
margin-bottom: 5px;
}
i didn't completely understand your question but i have tried to answer it.
you would need to edit
#header {
background: #FFFFFF
width: 100%;
padding: 20px 0px;
}
Using the emenu Yii extension for a menu. The underlying project for this extension is http://lwis.net/free-css-drop-down-menu/ .
Right now the sub menus display in a row (which does eventually wrap to a 2nd row). I'm using the "nvidia" theme.
How do I make submenus vertical? I want the items in the sub menu to stack vertically on top of one another.
This is a css issue. The inner <ul> should have the style: width : 100% which comes from dropdown.css, but it is being overridden by themes/nvidia.com/default.css where it is specified as: width: 170px. So you can change that value back to 100% by adding it in your own custom css file.
dropdown.css:
ul.dropdown ul {
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
z-index: 598;
width: 100%;
}
themes/nvidia.com/default.css:
ul.dropdown ul {
width: 170px;
background-color: #333;
color: #fff;
font-size: 11px;
text-transform: none;
filter: alpha(opacity=90);
-moz-opacity: .9;
KhtmlOpacity: .9;
opacity: .9;
}
mystyle.css:
ul.dropdown ul{
width:100% !important;
}
Is it possible to style JSF commandbutton tags to look like the following example:
http://www.bloggerswatch.com/internet/css-trick-submit-button-should-look-same-everywhere/
It works for the commandlink/
Yes, you should be able to do something similar using slightly different CSS that incorporates the images as CSS backgrounds rather than <img> tags:
Markup
<div class="buttons">
<h:commandButton value="Button Text" styleClass="apply"/>
<h:commandButton value="Button Text" styleClass="cross"/>
</div>
CSS
.buttons input {
margin: 5px;
padding: 5px 5px 5px 20px; /* 20px makes room for your background image */
border: 1px solid #aaa;
}
.buttons .apply {
background: #eee url(path/to/apply.png) no-repeat 0 50%;
}
.buttons .cross {
background: #eee url(path/to/cross.png) no-repeat 0 50%;
}