Hi i am working with js2+ primefaces here is my code to block UI
<table>
<h:form id="main">
<tr>
<p:growl --->
---
<p:dashboard id="board" model="#{adminD.userProfl}" disabled="true">
<p:panel id="adminActivity" header="Admin Activities">
<table id="hor-minimalist-b" >
<tbody>
<tr>
<td>
<h:commandLink action="#{photoValidation.ooDirectory()}" name="submit" type="submit" id="convertPhotos">
<h:outputText value="Convert All Photos in Databse "/>
<f:ajax execute=":main:adminActivity" render=":main:growl"/>
</h:commandLink>
</td>
</tr>
</tbody>
</table>
</p:panel>
</p:dashboard>
<p:blockUI block=":main:board" trigger=":main:convertPhotos">
LOADING<br />
<p:graphicImage value="#{facesContext.externalContext.requestContextPath}/resources/images/ajax-loader.gif"/>
</p:blockUI>
here board is dashboard id main is form id
also implemented managed bean with thread.sleep of 5 seconds
Remove all the :main: prefixes , since all this resides inside the same h:form , there no need to add that main prefix
Use
<p:blockUI block="board" trigger="convertPhotos">
Try changing h:commandLink to p:commandLink:
<p:commandLink actionListener="#{photoValidation.ooDirectory()}" update=":main:growl" id="convertPhotos"><h:outputText value="Convert All Photos in Databse "/></p:commandLink>
Can you try this code?
<p:blockUI block="board" trigger="adminActivity:convertPhotos">
It is only tipp but you can find component element by firebug or another web tool in browser.
Related
Now we put a couple of primefaces dialogs in datatable rows. This worked so far, but I want to move them out of the datatable.
Because there is always only one instance shown to the user of a particular dialog, I thought of updating it's values via Javascript before popping it up to the user. This would be the case for simple dialogs that only contain a couple of components and the information is already available on the client side.
What it used to be so far. (It's in HTML, not JSF, because I don't have the JSF code right now)
<table>
<tr>
<td>
<a onClick="show('dialog');" />
<div id='dialog'> <!-- the dialog -->
<input type="text" name="field" value="value" />
</div>
</td>
</tr>
</table>
e.g. what I want to achieve:
<table>
<tr>
<td>
<a onClick="updateDialog('dialog',{'field', 'value'}); show('dialog');" />
</td>
</tr>
</table>
<div id='dialog'> <!-- the dialog -->
<input type="text" name="field" value="value" />
</div>
Do you think it's feasible, or do you think there is already similar solutions out there in the wild? THanks.
Sounds like you want something like this... just make sure, the bean you store the instance to edit in survives the request. Make sure to read about partial processing and partial rendering in the PrimeFaces documentation which you can download for free: http://www.primefaces.org/documentation
<h:form id="tableForm">
<p:datatable value="#{carBean.cars}" var="car" ...>
<p:column>
<p:commandButton value="edit" action="#{carBean.edit(car)}" process="#this" update=":editForm" oncomplete="PF('carDialog').show();"/>
</p:column>
...
</p:datatable>
</h:form>
<h:form id="editForm">
<p:dialog widgetVar="carDialog" rendered="#{carBean.carToEdit ne null}">
<p:inputText value="#{carBean.carToEdit.brand" placeholder="brand" ... />
...
</p:dialog>
</h:form>
I have a tooltip set for an h:selectOneRadio which is correctly displayed in FF and Chrome but not in IE(9).
In the latter case what appears is a tooltip which goes beyond the left margin and just to the right margin of the page.
Here is how it appears in FF/Chrome:
and here in IE
Here is the code:
<tr>
<td>
<h:outputLabel value="#{msg.subscriptionFormFieldSubscriptionType}:" />
</td>
<td>
<h:selectOneRadio id="subscriptionType"
value="#{detailModel.afterObject.subscriptionType}"
<f:selectItems value="#{detailModel.subscriptionTypeValues}" />
<rich:tooltip id="tt1" styleClass="tooltip" for="detailForm:subscriptionType" layout="block" >
<span style="white-space: nowrap">
<h:outputText value="#{msg.subscriptionToolTipForSubscriptionType}" escape="false"/>
</span>
</rich:tooltip>
</h:selectOneRadio>
<h:messages for="subscriptionType" style="color:red; font-size:12px;" />
</td>
</tr>
I took the richfaces showcase sample (which works correctly in IE too) as sample, so I don't know where the problem is. Any idea/hint?
If more information is needed, please let me know.
Problem found: layout="block" was causing the problem.
Whats the advantage is JSF 2 Panel grid vs an HTML table?
e.g.
<h:panelGrid columns="1">
<h:outputText value="Hello"/>
</h:panelGrid>
vs
<table>
<tr>
<td>
<h:outputText value="Hello"/>
</td>
</tr>
</table>
"h:panelGrid" tag in JSF is used to generate HTML table tags. It places JSF components in rows and columns layout. The Advantage of using it is you do not have to type all those html tags.
For example, here you have to type all these html tags in your coding,
<table>
<tbody>
<tr>
<td>
Enter a Phone number :
</td>
<td>
<h:inputText id="input1" value="#{bean.input1}"
size="20" required="true"
label="Number" >
<f:convertNumber />
</h:inputText>
</td>
<td>
<h:message for="input1" style="color:red" />
</td>
</tr>
</tbody>
</table>
but the same thing can be done using "h:panelGrid" by typing the following,
<h:panelGrid columns="3">
Enter a Phone number :
<h:inputText id="input1" value="#{bean.input1}"
size="20" required="true"
label="Number" >
<f:convertNumber />
</h:inputText>
<h:message for="input1" style="color:red" />
</h:panelGrid>
JSF doc gives more details, and panelGrid has got some limitations too.
It would be very easy to align various panels and your can have JSF form control () within the panel, without much help from UI developer.
One of the limitations with PanelGrid is : It would not be easy to apply CSS styles. You need look for alternate solutions. But with standard html tags it would be easy to apply CSS styles. JSF2 Primefaces gives themes but I could not avoid CSS styles in a real time application development.
But with PanelGrid you can use almost any JSF control that fits in the rendered html of PanelGrid.
I m having problem with commandLink, it is working in my table at the first but other are made inside ui:repeate and the commandLink there is not working
<tr>
<td rowspan="#{form25Bean.forms1size}">Наименования научных
лабораторий:</td>
<td>#{form25Bean.forms1first.sciencenName}</td>
<td>#{form25Bean.forms1first.innovationName}</td>
<td>#{form25Bean.forms1first.ppcPortion}</td>
<td><h:commandLink value="удалить" id="cl2"
action="#{form25Bean.remove}">
<f:setPropertyActionListener
target="#{form25Bean.selectedForm}" value="#{form25Bean.forms1first}" />
</h:commandLink> <h:column>
<h:commandLink value="изменить" action="#{form25Bean.edit}">
<f:setPropertyActionListener
target="#{form25Bean.selectedForm}" value="#{form}" />
</h:commandLink>
</h:column></td>
</tr>
<ui:repeat var="f1" value="#{form25Bean.forms1}">
<h:form>
<tr>
<td>#{f1.sciencenName}</td>
<td>#{f1.innovationName}</td>
<td>#{f1.ppcPortion}</td>
<td><h:commandLink value="удалить" id="cl2"
action="#{form25Bean.remove}">
<f:setPropertyActionListener
target="#{form25Bean.selectedForm}" value="#{f1}" />
</h:commandLink>
<h:column>
<h:commandLink value="изменить" action="#{form25Bean.edit}">
<f:setPropertyActionListener
target="#{form25Bean.selectedForm}" value="#{f1}" />
</h:commandLink>
</h:column></td>
</tr>
</h:form>
</ui:repeat>
Looks like you got nested forms
There is a form wrapping your entire table (cause you got several h:commandLink above the <ui:repeat )
And there is a form inside the ui:repeat
Take a look at your generated source code (html) , you got <form>.... <form>....</form></form>
get rid of the nested forms... (for example remove the <h:form> from ui:repeat)
First, let me explain the structure. I have some JSF Facelets pages, which use a template to provide a common header with dynamically generated menus. Within that template, the menus are generated with the following code:
<ui:repeat var="item" value="#{mainMenuBackingBean.subMenuItemsList}">
<td class="#{item.cssClass}">
<h:outputLink id="submenu_#{item.nameText}" value="#{item.linkPath}" disabled="#{item.disabled}">
#{item.nameText}
</h:outputLink>
</td>
</ui:repeat>
Each individual page has a page backing bean which knows how to set up its menus, and so before the page is rendered the menus are set up with the following code:
<f:event listener="#{specificPageBackingBeanHere.setup}" type="preRenderView"></f:event>
Which calls the setup method in the abstract class that all specific page backing beans extend, which then makes some calls to add the right elements to the mainMenueBackingBean's menu lists. So far this has worked out perfectly for us, and we've had no issues, until now.
On a new page, we have a table with a dynamic layout as implemented with the following piece of code:
<table class="gridall">
<tr>
<td colspan="4" style="text-align: center;"><b>Table Title</td>
</tr>
<tr>
...
column headings here
...
</tr>
<ui:repeat var="item" value="#{outgoingFaxBacking.outgoingList}">
<tr bgcolor="#{item.status.color}">
<td style="text-align: center;" class="itemsTopCell">
<h:commandLink value="#{item.itemNo}" action="#{outgoingFaxBacking.testMe}" >
<f:ajax render=":rightColumn"/>
</h:commandLink>
<br/>
<b>Last: #{item.lastString}</b>
</td>
<td class="itemsTopCell">
#{item.description}
</td>
<td style="text-align: center" class="itemsTopCell">
<h:outputText value="#{item.quantity}">
<f:convertNumber maxFractionDigits="2"/>
</h:outputText>
</td>
<td style="text-align: center;" class="itemsTopCell">
<h:inputHidden id="notFilledNote" value="#{outgoingFaxBacking.notFilledNote}"/>
<h:commandButton action="#{outgoingFaxBacking.markNotFilled(item.id)}" onclick="return(notFilled());" value="Not Filled">
<f:ajax execute="notFilledNote" render="#form"/>
</h:commandButton>
</td>
</tr>
<tr bgcolor="#{item.status.color}">
<h:panelGroup rendered="#{empty item.note}">
<td style="border-top: 1px;" colspan="4">
#{item.sig}
</td>
</h:panelGroup>
<h:panelGroup rendered="#{not empty item.note}">
<td style="border-top: 1px; border-bottom:0px;" colspan="4">
#{item.sig}
</td>
</h:panelGroup>
</tr>
<h:panelGroup rendered="#{not empty item.note}">
<tr bgcolor="#{item.status.color}">
<td colspan="4" style="border-top: 1px;">
#{item.note}
</td>
</tr>
</h:panelGroup>
<tr>
<td style="border: 0px;font-size:2%" colspan="3">
</td>
</tr>
</ui:repeat>
</table>
The page renders perfectly the first time through. The problem is that when you click on either the commandLink or the commandButton in the table (and only this table, no other command element on the page causes this), an error is generated which reads as so:
serverError: class javax.faces.view.facelets.TagAttributeException /WEB-INF/templates/secure.xhtml #130,106 id="submenu_#{item.nameText}": Property 'nameText' not found on type org.ppa.db.serializabledb.FaxItemsContainer
The error location (#130,106) is the menu code I quoted above, but the type of object (FaxItemsContainer) being looked at is used in the dynamic table above, not the menus. After fiddling with this for a bit, and making sure it wasn't an ajax problem, or a ui:include problem, or anything else, we finally changed the var name in the table from "item" to "faxItem" and it appears to work.
So ultimately, my question is I thought that the var name for ui:repeat (and other JSF components) was local in scope, and therefore it shouldn't matter that two ui:repeats on the same page use the same var name; is this not the case? Do ui:repeat tags on the same page really require unique var names?
I'm running Mojarra 2.1.3 on Tomcat 7.