p:panel does not render in FireFox after Ajax call

UI Components for JSF
jgenchik
Posts: 97
Joined: 01 Feb 2010, 18:58

03 Feb 2010, 21:17

I am using primefaces-2.0.0.RC with JSF 2.0. FireFox version is: 3.6.

A page has two p:panels. One of the panels contains a p:pickList control and a h:commandButton used to submit an action. Without ajax, this works fine in Chrome, FireFox and IE, but when I add ajax to the command button, second panel, containing the button, disappear when button is clicked.
Following is the xhtml page with Ajax part commented out.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Insert title here</title>
</head>

<body>

<ui:composition template="/headerContentLayout.xhtml">

	<ui:define name="content">
		<h:messages styleClass="errorMessage" infoClass="infoMessage" showSummary="true" showDetail="true" globalOnly="true" />
		
		<h:form id="primeFacesDemoForm" prependId="false">
			<h:panelGrid id="primeFacesDemoGrid" columns="2" border="0" columnClasses="panelLabelColumn r, panelDataColumn l">
				
				<h:outputLabel for="date1" value="Date Picker:" />
				<p:calendar id="date1" value="#{primeFacesBean.date1}" navigator="false" />
				
				<h:outputText for="autoCompleteText" value="Autocomplete:" />
				<p:autoComplete id="autoCompleteText" value="#{primeFacesBean.autoCompleteText}" completeMethod="#{primeFacesBean.complete}" />
				
				<f:facet name="footer">
					<h:commandButton id="doSomething" action="#{primeFacesBean.showValues}" immediate="false" value="Submit" title="Submit" />
				</f:facet>
			</h:panelGrid>
			
			<p:panel id="dataTablePanel" header="Data Table" footer="dataTable" toggleable="true">
			<h:dataTable id="rolesDataTable" value="#{primeFacesBean.allRoles}" var="role">
				<h:column>
					<f:facet name="header">id</f:facet>
					<h:outputText value="#{role.id}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">name</f:facet>
					<h:outputText value="#{role.name}" />
				</h:column>
				
				<h:column>
					<f:facet name="header">description</f:facet>
					<h:outputText value="#{role.description}" />
				</h:column>
				
				<f:facet name="footer">
					<h:commandButton id="printDataTableButton" value="Print">
						<p:printer target="rolesDataTable" />
					</h:commandButton>
				</f:facet>
			</h:dataTable>
			
			<h:commandLink value="export">  
            	<!--p:dataExporter type="xml" target="rolesDataTable" fileName="roles" pageOnly="true" /-->  
            	<p:dataExporter type="pdf" target="rolesDataTable" fileName="roles" pageOnly="true" /> 
        	</h:commandLink> 
			</p:panel>
			
			<p:panel id="pickListPanel" header="Pick List" footer="with Ajax" toggleable="false" style="margin-top: 60px;">
				<p:pickList id="rolesPickList" value="#{primeFacesBean.rolesPicker}" var="role" itemLabel="#{role.name}" itemValue="#{role}" converter="roleConverter" converterMessage="Converter error" />
				<h:message for="rolesPickList" />
				
				<br />
				<h:commandButton id="showPickedRolesButton" action="#{primeFacesBean.showPickedRoles}" value="Show Picked" />
									<!-- onclick="jsf.ajax.request(this,event, {execute:'pickListPanel',render:'pickListPanel'});return false;" /-->
			</p:panel>
		</h:form>
		
		<h:outputStylesheet name="css/style.css" />
	</ui:define>
</ui:composition>

</body>
</html>
Environment: GlassFish 3.1, JSF 2.1.1, PrimeFaces-3.0.M2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 12:48

Can you try;

Code: Select all

<p:commandButton update="pickListPanel" id="showPickedRolesButton" action="#{primeFacesBean.showPickedRoles}" value="Show Picked" />
instead of h:commandButton.

jgenchik
Posts: 97
Joined: 01 Feb 2010, 18:58

04 Feb 2010, 16:55

I followed your advise and replaced h:commandButton with p:commandButton, but I am getting a strange error:
javax.el.PropertyNotFoundException: The class 'com.xxx.tryapp.web.PrimeFacesBean_$$_javassist_61' does not have the property 'showPickedRoles'.
This is the action method:

Code: Select all

public String showPickedRoles(){
		for(RoleEntity role : this.rolesPicker.getTarget()){
			log.info(" ********************* role: "+role);
		}
		
		return null;
	}
But I also have another comment, even if p:commandButton will work properly. The reason why I like PrimeFaces so much is because it is not intrusive. It is not a framework like ICEFaces that takes over the entire JSF life cycle, but rather a collection of components that can be easily integrated with the Reference Implementation of JSF. For me this is one of the best features of PrimeFaecs. So, it would be great if all the functionality worked with the RI commandButton.
Just my opinion.. and thank you for your quick replies. As I evaluate PrimeFaces, I like it better and better.
Environment: GlassFish 3.1, JSF 2.1.1, PrimeFaces-3.0.M2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 17:04

Yes, I've suggested p:commandButton to see if it makes a difference, idea of PrimeFaces is keeping flexibility while hiding complexity.

I can't figure out much about environment, do you use seam or something like that because your bean seems to be loaded with javaassist.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 17:05

Also try f:ajax inside h:commandButton instead of manually writing jsf.ajax.... javascript, f:ajax does that for you.

jgenchik
Posts: 97
Joined: 01 Feb 2010, 18:58

04 Feb 2010, 17:17

I am not using seam. I think javaassist is there because I am using Context and Dependency Injection (CDI), so istead of @jsf.faces.bean.ManagedBean annotation I am using @javax.inject.Named(value="primeFacesBean").
I will try f:ajax and will let you know.

Thanks
Environment: GlassFish 3.1, JSF 2.1.1, PrimeFaces-3.0.M2

jgenchik
Posts: 97
Joined: 01 Feb 2010, 18:58

04 Feb 2010, 17:25

I tried it with f:ajax

Code: Select all

<h:commandButton id="showPickedRolesButton" action="#{primeFacesBean.showPickedRoles}" value="Show Picked">
	<f:ajax execute="pickListPanel" render="pickListPanel" />
</h:commandButton>
Same behavior.
Environment: GlassFish 3.1, JSF 2.1.1, PrimeFaces-3.0.M2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 17:31

So what happens to panel after you click. Disappear? Can you check ajax response with firebug?

jgenchik
Posts: 97
Joined: 01 Feb 2010, 18:58

04 Feb 2010, 17:44

After command button is clicked, the bottom panel disappears. If I refresh the page, it is visible. I am not sure what do you want me to check with FireBug. The Script panel contains the following:

Code: Select all

 ....loading....
Firebug's log limit has been reached. 0 entries not shown.		Preferences	 
POST http://localhost:8080/TryWeb/primeFacesDemo.jsf?cid=21
POST http://localhost:8080/TryWeb/primeFacesDemo.jsf?cid=21
	
200 OK
		54ms	
jsf.js...x.faces (line 1)
		
 
	
$
	undefined
 
	
PrimeFaces
	Object { widget=Object, more...}
 
	
YAHOO
	Object { env=Object, more...}
 
	
dataTablePanel_widget
	Object { id="#dataTablePanel", more...}
 
	
jsf
	Object { ajax=Object, more...}
 
	
mojarra
	Object {}
 
	
get mozInnerScreenX
	70
 
	
get mozInnerScreenY
	181
 
	
pickListPanel_widget
	Object { id="#pickListPanel", more...}
 
	
rolesPickList_widget
	Object { id="rolesPickList", more...}
 
	
jQuery
	function()
 
	
getInterface
	getInterface()
 
	
onload
	onload(event)
 
	
setInitialFocus
	setInitialFocus()
 
	
Components
	nsXPCComponents { interfaces=nsXPCComponents_Interfaces, more...}
 
	
get applicationCache
	undefined items in offline cache
 
	
get closed
	false
 
	
get console
	Object { firebug="1.5.0"}
 
	
get content
	Window primeFacesDemo.jsf?cid=21
 
	
get controllers
	XULControllers {}
 
	
get crypto
	Crypto { version="2.4", more...}
 
	
defaultStatus
	""
 
	
get directories
	BarProp { visible=true}
 
	
document
	Document primeFacesDemo.jsf?cid=21
 
	
get frameElement
	null
 
	
get frames
	Window primeFacesDemo.jsf?cid=21
 
	
fullScreen
	false
 
	
globalStorage
	StorageList {}
 
	
get history
	24 history entries
 
	
innerHeight
	350
 
	
innerWidth
	1180
 
	
get length
	0
 
	
get localStorage
	Storage {}
 
	
location
	http://localhost:8080/TryWeb/primeFacesDemo.jsf?cid=21 { href="http://localhost:8080/T...imeFacesDemo.jsf?cid=21", more...}
 
	
get locationbar
	BarProp { visible=true}
 
	
get menubar
	BarProp { visible=true}
 
	
name
	""
 
	
navigator
	Navigator { userAgent="Mozilla/5.0 (Windows; U...ko/20100115 Firefox/3.6", more...}
 
	
netscape
	Object {}
 
	
opener
	null
 
	
outerHeight
	908
 
	
outerWidth
	1188
 
	
get pageXOffset
	0
 
	
get pageYOffset
	0
 
	
parent
	Window primeFacesDemo.jsf?cid=21
 
	
get personalbar
	BarProp { visible=true}
 
	
get pkcs11
	null
 
	
get screen
	Screen { top=0, more...}
 
	
screenX
	66
 
	
screenY
	12
 
	
get scrollMaxX
	1
 
	
get scrollMaxY
	1001
 
	
get scrollX
	0
 
	
get scrollY
	0
 
	
get scrollbars
	BarProp { visible=true}
 
	
get self
	Window primeFacesDemo.jsf?cid=21
 
	
sessionStorage
	Storage {}
 
	
status
	""
 
	
get statusbar
	BarProp { visible=true}
 
	
get toolbar
	BarProp { visible=true}
 
	
top
	Window primeFacesDemo.jsf?cid=21
 
	
window
	Window primeFacesDemo.jsf?cid=21
1<?xml version="1.0" encoding="utf-8"?>
2<partial-response><changes><update id="pickListPanel"><![CDATA[<script type="text/javascript">PrimeFaces.onContentReady('pickListPanel', function() {
3pickListPanel_widget = new PrimeFaces.widget.Panel('pickListPanel', {});});</script><div id="pickListPanel" class="pf-panel" style="margin-top: 60px;"><div id="pickListPanel_hd" class="pf-panel-hd">Pick List</div><div id="pickListPanel_bd" class="pf-panel-bd"><script type="text/javascript">PrimeFaces.onContentReady('rolesPickList', function() {
4rolesPickList_widget = new PrimeFaces.widget.PickList('rolesPickList', {});
5});</script><table id="rolesPickList"><tbody><tr><td><select id="rolesPickList_source" name="rolesPickList_source" class="pf-picklist-source" multiple="multiple" ondblclick="rolesPickList_widget.add();"><option value="1">agent</option><option value="4">Name</option><option value="5">Name</option><option value="6">Name</option><option value="7">Name</option><option value="8">Name</option><option value="9">Name</option><option value="10">Name</option><option value="11">Name</option><option value="12">Name</option><option value="13">Name</option><option value="14">Name</option><option value="15">Name</option><option value="16">Name</option><option value="17">Name</option><option value="18">Name</option><option value="19">Name</option><option value="20">Name</option><option value="21">Name</option><option value="22">Name</option><option value="23">Name</option><option value="24">Name</option></select><input type="hidden" id="rolesPickList_sourceList" name="rolesPickList_sourceList" value="1;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;" /></td><td><div class="pf-picklist-control"><button type="push" style="width:35px;" onclick="rolesPickList_widget.add();return false;">></button></div><div class="pf-picklist-control"><button type="push" style="width:35px;" onclick="rolesPickList_widget.addAll();return false;">>></button></div><div class="pf-picklist-control"><button type="push" style="width:35px;" onclick="rolesPickList_widget.remove();return false;"><</button></div><div class="pf-picklist-control"><button type="push" style="width:35px;" onclick="rolesPickList_widget.removeAll();return false;"><<</button></div></td><td><select id="rolesPickList_target" name="rolesPickList_target" class="pf-picklist-target" multiple="multiple" ondblclick="rolesPickList_widget.remove();"><option value="3">administrator</option><option value="2">supervisor</option></select><input type="hidden" id="rolesPickList_targetList" name="rolesPickList_targetList" value="3;2;" /></td></tr></tbody></table>
6
7 <br /><input id="showPickedRolesButton" type="submit" name="showPickedRolesButton" value="Show Picked" onclick="mojarra.ab(this,event,'action','pickListPanel','pickListPanel');return false" />
8 </div><div id="pickListPanel_ft" class="pf-panel-ft">with Ajax</div></div>]]></update><update id="javax.faces.ViewState"><![CDATA[7516909823465455687:6324296426767597683]]></update></changes></partial-response>

after command button was clicked.
Please let me know if you want me to do anything else.
Environment: GlassFish 3.1, JSF 2.1.1, PrimeFaces-3.0.M2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Feb 2010, 18:03

net panel provides information about response.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests