PrimeFaces dialog not working in Chrome browser - jsf-2

As you can see I am trying to display a dialog box on click on the command link, the dialog is displayed in IE and Firefox, but not in Google Chrome v23, please suggest.
<h:form id="myForm">
<p:tabView id="tabView">
<p:tab id="tab1" title="Tab 1">
<h:panelGrid columns="1" cellpadding="10">
<h:dataTable value="#{testBean.dataList}" var="data">
<h:column>
<h:outputText value="#{data}" />
</h:column>
<h:column>
<p:commandLink action="#{testBean.loadCommentHistory(data)}"
update=":myForm:tabView:dialog" oncomplete="dlg.show()">
<h:graphicImage url="resources/theme1/images/comments.gif"
styleClass="basicImageStyle" />
</p:commandLink>
</h:column>
</h:dataTable>
<p:dialog id="dialog" header="Dynamic Dialog" widgetVar="dlg">
<h:outputText value="#{testBean.commentHistory}" />
</p:dialog>
</h:panelGrid>
</p:tab>
</p:tabView>
</h:form>

When you update the dialog the dialog is reset to the default state which is hidden. If you call dialog.show() and update the dialog the dialog is hidden again. Chrome (being probably faster than IE or FireFox) seems to handle this differently. A solution would be to wrap the content of the dialog in a container and update the container.
<p:commandLink action="#{testBean.loadCommentHistory(data)}"
update=":myForm:tabView:dialog-content" oncomplete="dlg.show()">
<h:graphicImage url="resources/theme1/images/comments.gif"
styleClass="basicImageStyle" />
</p:commandLink>
<p:dialog id="dialog" header="Dynamic Dialog" widgetVar="dlg">
<p:outputPanel id="dialog-content">
<h:outputText value="#{testBean.commentHistory}" />
</p:outputPanel>
</p:dialog>

Try to encapsulate the page in a f:view tag if you haven't already. There is some problem when it is not present with Chrome and Safari. See http://primefaces.org/faq.html question 3
<html xmnls=... >
<f:view contentType="text/html">
<h:head>
....
</h:head>
<h:body>
....
</h:body>
</f:view>
</html>

Related

f:param works only first time when using the same name in multiple commandButtons

My requierement is to upload some data and generate different reports for download with one click. In the example below I show appropriate button witch has a parameter that is sent to the download bean to select the correct version of the report.
But the f:param is only set the first time a p:commandButton is executed and then stays the same also for other buttons. Why is that and how can I solve this issue?
<h:form id="mainForm" enctype="multipart/form-data">
<p:fileUpload ...../>
....
....
<p:selectBooleanCheckbox id="opt1"
<p:ajax event="change" update="hiddingPanel"/>
</p:selectBooleanCheckbox>
<p:selectBooleanCheckbox id="opt2"
<p:ajax event="change" update="hiddingPanel"/>
</p:selectBooleanCheckbox>
<h:panelGroup id="hiddingPanel">
<p:commandButton id="doOpt1" rendered="#{bean.opt1 and !bean.opt2}"
actionListener="#{bean.readFile}" ajax="false" />
<p:fileDownload value="#{downloadBean.content}" />
<f:param name="reportType" value="REPORT1"/>
</p:commandButton>
<p:commandButton id="doOpt1" rendered="#{!bean.opt1 and bean.opt2}"
actionListener="#{bean.readFile}" ajax="false" />
<p:fileDownload value="#{downloadBean.content}" />
<f:param name="reportType" value="REPORT2"/>
</p:commandButton>
</h:panelGroup>
</h:form>
Thanks for any suggestions!
Regards.

Command Link with in a datatable not working

I am having a problem with primefaces command link.
I have two <h:form> which are not nested the link from the second <h:form> is not triggered.
<h:form>
<p:dataTable>
<p:column>
</p:column>
<p:column>
<p:commandLink onclick="dialog.show()"/>
</p:column>
</dataTable>
</h:form>
<p:dialogBox widgetWar="dialog">
<h:form>
<p:dataList value="#{bean.List}" var="var">
<p:commandLink value="#{var.name}" actionListener="#{bean.viewName(var.id)}"/>
</dataList>
</h:form>
</p:dialogBox>
The command Link from the dialog box is not working and there are no exceptions thrown.
Can any one help?
Your command Link shoud be inside <p:column>.
<p:dataList value="#{bean.List}" var="var">
<p:column>
<p:commandLink value="#{var.name}" actionListener="#{bean.viewName(var.id)}"/>
</p:column>
</p:dataList>
This is necessary in order tou have data Selection inside dataList. Related problem is here

a4j:commandLink not work at first time

I hava a rich:tabPanel where i can add and remove tab dynamically
<rich:tabPanel id="tabsPanel" switchType="client" activeItem="#{tabsBean.activeTab}" itemChangeListener="#{tabsBean.tabChange()}" >
<c:forEach var="tab" items="#{tabsBean.tabs}" >
<rich:tab name="#{tab.name}" onheaderclick="switchTab('#{tab.name}');" >
<f:facet name="header">
<h:panelGrid columns="2">
<h:outputText value="#{tab.name}" />
<h:graphicImage value="#{pathImmagini.pathImmagineElimina}"
style="width:12px; height:12px;"
onclick="myFunc('#{tab.name}'); Event.stop(event);"/>
</h:panelGrid>
</f:facet>
<h:form id="#{tab.name}" >
<ui:include src="#{tab.pathComponent}" />
</h:form>
</rich:tab>
</c:forEach>
</rich:tabPanel>
where each tab has a its component *.xhtml (tab.pathComponent) , within of this components i have many a4j:commandlink that not works at first time.
this is one of my components (tab.pathComponent)
<rich:toolbar height="30" >
<a4j:commandLink action="#{tab.setNewObject('Nuovo Cliente')}" render="pannelloDatiCliente" execute="#this" >
<h:graphicImage value="#{pathImmagini.pathImmagineAggiungiSoggetto}"/>
</a4j:commandLink>
</rich:toolbar>
How i can do?
can you give bit more information regarding your xhtml. normally second click problem happens because of partial rendereing of page or UI. Can't tell the problem only with this part of code.

How to use <h:form> in <rich:tabPanel>

I'm developing my first JSF2 + Richfaces application and now I have this problem.
I have the following rich:tabPanel to which add and remove dynamically tab.
<h:form>
<rich:tabPanel id="tabsPanel" switchType="ajax" activeItem="#{tabsBean.activeTab}" >
<c:forEach var="tab" items="#{tabsBean.tabs}" styleClass="myRightPanel">
<rich:tab name="#{tab.name}" styleClass="myTab" >
<h:form id="#{tab.name}" >
<ui:include src="#{tab.pathDaIncludere}" />
</h:form>
</rich:tab>
</c:forEach>
</rich:tabPanel>
</h:form>
but to run I must add a <h:form> around each <rich:tab> otherwise the actions in the tabs will not work.
Is correct insert <h:form> in each tab?

Left Layout disappears whenever datatable is added within the center Pane of primeFaces Layout

Im using Jsf 2.0 and primefaces exstensions component pe:layout to create a page with left navigation menu bar ,bottom footer and center pane for content everthing works fine but when ever i add primefaces datatable (p:datatable) in the center pane the header and footer layouts are preserved but the left pane disappears and the center pane occupies the entire page. I tried setting width and height of the datatable but nothing seems to work. The page displays correctly without datatable. Any help would be greatly appreciated.
Please find below the code with datatable:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<ui:composition template="/templates/showcaseLayout.xhtml">
<ui:define name="centerContent">
<f:facet name="header">
<h:outputText value="Jan Sampark"/>
</f:facet>
<h:panelGroup layout="block" styleClass="centerContent">
Welcome to the Menu Page.
<p:growl id="messages" showDetail="true"/>
</h:panelGroup>
<p:tabView id="tabView">
<p:tab id="tab1" title="Godfather Part I">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab1Img" value="/images/godfather/godfather1.jpg" />
<h:outputText id="tab1Text"
value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. T
hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect,
but given to ruthless violence whenever anything stands against the good of the family." />
</h:panelGrid>
</p:tab>
<p:tab id="tab2" title="Godfather Part II">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab2Img" value="/images/godfather/godfather2.jpg" />
<h:outputText id="tab2Text" value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream.
In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy,
killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows."/>
</h:panelGrid>
</p:tab>
<p:tab id="tab3" title="Godfather Part III">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab3Img" value="/images/godfather/godfather3.jpg" />
<h:outputText id="tab3Text" value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.
Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate."/>
</h:panelGrid>
</p:tab>
</p:tabView>
<h:panelGroup layout="block" styleClass="centerContent">
<p:dataTable var="car" value="#{tableBean.carsSmall}" id="carList" editable="true" style="table-layout: fixed"
scrollable="true" scrollHeight="250" scrollWidth="300">
<f:facet name="header">
In-Cell Editing
</f:facet>
<!-- <p:ajax event="rowEdit" listener="#{tableBean.onEdit}" update=":form:messages" /> -->
<!-- <p:ajax event="rowEditCancel" listener="#{tableBean.onCancel}" update=":form:messages" /> -->
<p:column headerText="Model" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.model}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{car.model}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Manufacturer">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.manufacturer}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.manufacturer}" >
<f:selectItems value="#{tableBean.manufacturers}"
var="man"
itemLabel="#{man}"
itemValue="#{man}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Color">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.color}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.color}" >
<f:selectItems value="#{tableBean.colors}"
var="color"
itemLabel="#{color}"
itemValue="#{color}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options">
<p:rowEditor />
</p:column>
</p:dataTable>
</h:panelGroup>
</ui:define>
<ui:define name="docuTable">
<ui:include src="/sections/shared/documentation.xhtml">
<ui:param name="tagName" value="timeline"/>
</ui:include>
</ui:define>
</ui:composition>
</html>

Resources