submit a parameter with PrimeFaces onClick? - jsf

I have this Table:
.divTable{
display: table;
width: 50%;
padding-top: 100px;
padding-left: 100px;
margin-left: auto;
margin-right: auto;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell, .divTableHead {
border: 1px solid #999999;
display: table-cell;
padding: 3px 10px;
background-color: #ffffff;
width: 50%;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
width: 100%;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
<div class="divTable">
<div class="divTableBody">
<ui:repeat var="customerInList" value="#{customerListController.resultMap.currentPositionResultList}"> <div class="divTableRow">
<div class="divTableCell">#{customerInList.lastName} #{customerInList.firstName}</div>
<div class="divTableCell">#{customerInList.postalStreet}
<p:commandButton id="editCustomerButton" label="+" iconPos="center" onclick="PF('editCustomerDialog').show()"/>
<br/>#{customerInList.postalCode} #{customerInList.postalCity}
<br/>#{customerInList.phoneNumber}
<br/>#{customerInList.email}
</div>
</div>
</ui:repeat>
</div>
</div>
<p:dialog widgetVar="editCustomerDialog">
</p:dialog>
And this Method
public void parseParameter(int ID){
this.ID = ID;
}
so here comes my problem.
As you can maybe already see I am trying to create a Popup to show more details about the customer. My Idea was that I could parse the Id of the customer from an Invisible div or something like this so I can get the remaining data from my database with this ID but that did not work for me.
Is there any other way to do this ?

You can use a f:setPropertyActionListener to set values to your bean from your p:commandButton then use the action event of your button to get any extra data from your DB and you can show your dialog on the oncomplete event instead of onclick so it get execute after your bean method.
<p:commandButton id="editCustomerButton" label="+" iconPos="center" action="#{customerListController.methodToGetYourRemainingData}" oncomplete="PF('editCustomerDialog').show()">
<f:setPropertyActionListener target="#{customerListController.ID}" value="#{customerInList.ID}" />
</p:commandButton>

Related

Flexbox text alignment on mobile

So, I am using flexbox for some columns. Basically column 1 is left-aligned, column two i centered, and column three is right-aligned. No big deal, or so I thought. In Chrome, everything looks fine, even when looking at things through Chrome's Inspect tool...but on my iPhone I can't get the right column to justify-content.
My code looks like:
<div id="nav">
<div class="wrap">
<div>
<p><i class="far fa-dot-circle"></i> Watch</p>
</div>
<div>
<p><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="" title="" /></p>
</div>
<div>
<p><i class="fas fa-donate"></i> Give</p>
</div>
</div>
</div>
The css looks like:
#nav div {
align-items: center;
display: flex;
flex: 1;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
letter-spacing: 2px;
line-height: 18px;
padding: 10px 20px 0;
text-transform: uppercase;
}
#nav > .wrap > div:nth-child(1) {
background: #00ff00;
justify-content: left;
}
#nav > .wrap > div:nth-child(2) {
background: #ff0000;
justify-content: center;
}
#nav > .wrap > div:nth-child(3) {
background: #0000ff;
justify-content: right;
}
#nav img {
max-width: 175px;
width: 100%;
}
#nav i {
color: #fff;
margin-right: 5px;
}
#nav a {
color: #fff;
text-decoration: none;
}
Here is the Fiddle: https://jsfiddle.net/1kw5g3h7/
I added the following code this morning and this works:
#nav > .wrap > div:nth-child(3) p {
text-align: right;
width: 100%;
}
I don't like this approach, it seems like to me the justify-content just isn't working is there a way to fix this using flexbox? I'm trying to understand why my original code isn't working on my iPhone? Maybe it's because I have Font Awesome icons in front of the text, I just don't know. Any ideas?
Thanks,
Josh
I didn't realize until now that I hadn't ever posted my final code. This is what I ended up with: https://jsfiddle.net/tc36e24s/2/
HTML:
<div id="head">
<div id="nav">
<i class="ion-android-close"></i>
<ul>
<li>Watch</li>
<li>Give</li>
<li><img src="images/logo.png" alt="Logo" title="Logo" /></li>
<li>Visitors</li>
<li>Contact</li>
</ul>
</div>
<div id="logo">
<p><img src="images/logo.png" alt="Logo" title="Logo" /></p>
<div onclick="openNav()" class="open">
<i class="ion-android-menu"></i>
</div>
</div>
</div>
CSS
body {
background: #009151;
}
#head {
display: flex;
flex-flow: column;
height: 100vh;
}
#nav ul {
flex: 0 1 auto;
}
#nav ul img {
max-width: 175px;
width: 100%;
}
#nav ul i {
color: #9ac2e7;
margin-right: 5px;
}
#nav li {
font-family: 'Open Sans', sans-serif;
letter-spacing: 2px;
line-height: 18px;
padding: 10px 20px 0;
text-align: center;
text-transform: uppercase;
}
#logo {
display: flex;
}
#logo img {
max-width: 200px;
margin: 20px 30px;
width: 100%;
}
#media screen and (max-width: 800px) {
#head .open {
color: #9ac2e7;
font-size: 30px;
margin: 20px 30px;
text-align: right;
width: 100%;
}
#head .open:hover {
cursor: pointer;
}
#nav {
background: #9ac2e7;
display: none;
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 1;
}
#nav ul {
align-items: center;
display: flex;
flex-flow: column;
height: 100%;
justify-content: center;
width: 100%;
}
#nav ul a {
color: #000;
text-decoration: none;
}
#nav li {
font-size: 20px;
padding: 10px 0;
}
#nav li:nth-child(3) {
display: none;
}
#nav .close {
color: #000;
font-size: 30px;
position: absolute;
right: 30px;
top: 20px;
}
}
#media screen and (min-width: 801px) {
#nav .close {
display: none;
}
#nav[style] {
display: block !important;
}
#nav ul {
align-items: center;
display: flex;
}
#nav ul a {
color: #9ac2e7;
text-decoration: none;
}
#nav li {
flex: 1;
font-size: 14px;
}
#logo {
display: none;
}
}
JS
function openNav() {
document.body.style.overflow="hidden";
document.getElementById("nav").style.display = "block";
}
function closeNav() {
document.body.style.overflow="scroll";
document.getElementById("nav").style.display = "none";
}
I added some JS to make my menu work on mobile, but other than that this is code I went with...which is pretty much the same as before except I added two additional links (one on each side of the logo).
Thanks,
Josh

classed image not aligning vertically

My flex container holds three divs,
every div has property of flex-grow
I have a classed image that does not work on align-items: center;
this is the flex container
.top-container {
display: flex;
width: 100% !important;
height: 70px;
}
and this is the container inside
.top-notifications {
flex-grow: 6;
background-color: #F8F9F9;
text-align: right;
align-items: center;
}
and the image class is
.user-picture {
width: 35px;
height: 35px;
border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
}
every elements in boxes are aligned centered but the classed image
body {
margin: 0;
}
.top-container {
display: flex;
width: 100% !important;
height: 70px;
}
.logo {
background-color: #EAFAF1;
display:flex;
align-items:center;
}
.top-menu {
background-color: #FEF9E7;
display:flex;
align-items:center;
}
.top-notifications {
flex-grow: 1;
display:flex;
justify-content: flex-end;
align-items: center;
background-color: #F8F9F9;
}
/* top menu */
.top-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #FEF9E7;
}
.top-menu li {
float: left;
}
.top-menu li a {
display: block;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
margin: 5px;
}
.top-menu li a:hover {
background-color: #85C1E9;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
margin: 5px;
}
/* end top menu */
.user-picture {
width: 35px;
height: 35px;
border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
}
<div class="top-container">
<div class="logo"><img src="images/logo.png" class="logo" /> </div>
<div class="top-menu">
<ul>
<li><a class="active" href="#home">Dashboard</a></li>
<li>Users</li>
<li>Settings</li>
</ul>
</div>
<div class="top-notifications">
Notifications<i class="fa fa-bell-o fa-lg"></i>
Reports<i class="fa fa-flag fa-lg"></i>
<img src="images/boy.png" class="user-picture" />
</div>
</div>
align-items:center; is used on the flex parent, not on the flex item itself. See css flex guide

FlipSwitch style in Xpages

I would like to create a checkbox that looks like flipswitch.
I used this CSS classes. and I used this design elements. But I could not succeded. There is something that i missed. I do not know how to manage that?
Codes in XPages:
<div class="onoffswitch">
<xp:checkBox text="Label" id="onoffswitch"
defaultChecked="true">
<span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
</xp:checkBox>
</div>
CSS Class: Resources\Style Sheets
.onoffswitch {
position: relative; width: 90px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 20px;
}
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "ON";
padding-left: 10px;
background-color: #34A7C1; color: #FFFFFF;
}
.onoffswitch-inner:after {
content: "OFF";
padding-right: 10px;
background-color: #EEEEEE; color: #999999;
text-align: right;
}
.onoffswitch-switch {
display: block; width: 18px; margin: 6px;
background: #FFFFFF;
position: absolute; top: 0; bottom: 0;
right: 56px;
border: 2px solid #999999; border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
I find that when you need to put markup inside a control it mostly won't work because the XPages rendering will change or ignore it. To get around this I use plain markup with a hidden control located outside of the markup. I manage the state of the hidden control with JQuery.
Here is a working example for your FlipSwitch:
<xp:checkBox text="Label" id="checkBox1"></xp:checkBox>
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch"
onclick="x$('#{id:checkBox1}').prop('checked', !(x$('#{id:checkBox1}').prop('checked')) )" />
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
The x$() function is a handly utility from Mark Roden:
function x$(idTag, param){ //Updated 18 Feb 2012
idTag=idTag.replace(/:/gi, "\\:")+(param ? param : "");
return($("#"+idTag));
}

Why is the button on my site not working?

If you look here... http://matiny.tk/Mixed%20Swim/Mixed.html
This is a simple site I'm making. It uses Bootstrap to switch the menu when the screen shrinks. Nicely enough, the Menu label/checkbox combo is not working, though it has worked on another site of mine. This is the relevant code...
<label for="menulogo" id="menulabel" class="visible-sm visible-xs"><img src="Menu.png"></label>
<input type="checkbox" id="menulogo">
</nav>
<nav id="menu">
SHOP
ABOUT
BLOG
GALLERY
CONTACT
</nav>
label {
font-size: 40px;
width: 100%;
color: white;
z-index: 2;
}
#menulogo {
opacity: 0;
}
#menu a {
background: rgba(0,0,0,.35);
font-size: 50px;
color: white;
height: 75px;
}
#menu {
margin-top: 100px;
text-align:center;
z-index: 3;
display: none;
position: fixed;
}
#menulogo:checked + #menu {
display: block;
}
As it turns out, my order of elements was incorrect. If one is going to use something like... #menulogo:checked + #menu, then the + or ~ selector means that the nav with #menu has to go right after the checkbox input, like so...
<label for="menulogo" id="menulabel" class="visible-sm visible-xs"><img src="Menu.png"> MENU</label>
<input type="checkbox" id="menulogo">
<!--These must be in sequence-->
<nav id="menu">
SHOP
ABOUT
BLOG
GALLERY
CONTACT
</nav>

rich:calendar : Icon hidden by an other component

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;
}

Resources