TouchFaces actionListener for rowItem

UI Components for JSF
Post Reply
imsja
Posts: 4
Joined: 27 Jan 2010, 23:23

28 Jan 2010, 00:00

Being new to primefaces, but already impressed about its completeness, I would like to implement mobile access to our enterprise backends using TouchFaces. Actually I have downloaded the demo show case with snapshot 1.0.0 from PrimeFaces and installed it onto a Windows XP System, running Tomcat 6.0.16.

One feature, that does not work in my local installation, is the News demo. I found out, that the actionListeners on a rowItem tag are not fired. The switch to the next view works, but the content is empty because data to be fetched by the actionListener stay empty. Our self developed solution, which makes heavy use of the actionListeners, does not work either.

As this feature is quite important for our solution (fetching data dynamically via an actionListener upon a rowItem selection) , we are very interested in any hint for solving that issue.

The same demo on the demo site in the Internet works on the same machine and browsers without any complaints.

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

28 Jan 2010, 15:28

So online demo works but your local does not?

Any errors? Can you post your code?

imsja
Posts: 4
Joined: 27 Jan 2010, 23:23

29 Jan 2010, 23:05

Maybe my explanation was confusing. The TouchFaces demo on the PrimeFaces site works. The same application downloaded and installed as war file in my local Tomcat installation does almost. What fails is the News example which makes use of actionListeners in combination with the rowItem tag.

My xhtml code looks like this:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"	
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:i="http://primefaces.prime.com.tr/touch"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	contentType="text/html">
	
	<i:application icon="../../images/touch/newsicon.png">
	
		<i:view id="home" title="Customers">
		
			<f:facet name="rightNavBar">
				<i:navBarControl label="About" view="about" type="button" effect="slideup"/>
			</f:facet>

			<h:form  prependId="false"> 
				<p:commandLink actionListener="#{customerBean.loadDemoCustomers}"  style="margin:10px 10px;" styleClass="whiteButton" update="customerList">Load customers</p:commandLink>
				<i:tableView id="customerList">
					<i:rowGroup>					
						<ui:repeat value="#{customerBean.customers}" var="row">
							<i:rowItem value="#{row.name1}" view="details" actionListener="#{customerBean.select}" update="customerDetails">
								<f:param name="customerNumber" value="#{row.customerNumber}" />
							</i:rowItem>
						</ui:repeat>						
					</i:rowGroup>
				</i:tableView>				
			</h:form>
		</i:view>

		<i:view id="details" title="Details">
			<f:facet name="leftNavBar">
				<i:navBarControl label="Customer Details" view="home" />
			</f:facet>
				
			<h:form prependId="false">
				<i:tableView id="customerDetails">
					<i:rowGroup title="Details">					
						<i:rowItem value="#{customerBean.currentCustomer.customerNumber}"/>
						<i:rowItem value="#{customerBean.currentCustomer.name1}"/>
					</i:rowGroup>
				</i:tableView>
			</h:form>
		</i:view>	
		<i:view id="about" title="About">
			<f:facet name="leftNavBar">
				<i:navBarControl label="Home" view="home" />
			</f:facet>
			<center>
				<p style="font-size:24px;margin:84px 0 20px 0;">Created with TouchFaces</p>
				<img src="../../images/touch/touchicon.png" />
			</center>
		</i:view>
		
	</i:application>
	
</f:view>
select is the method to be called from the backing bean customerBean, which extracts the selected data row based on the parameter customerNumber. But clicking on a rowItem the system does not fire the actionListener. The switch to the next view is performed, but the instance variable currentCustomer as there is no assignement in the actionListener select.

Code: Select all

public class CustomerBean {
      ....	
      public void select(ActionEvent actionEvent) {
		String	customerNumber = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("customerNumber");
		
		for(DemoCustomer customer : getCustomers()){
			if(customerNumber.equals(customer.getCustomerNumber())){
				setCurrentCustomer(customer);
				break;
			}
		}
	}
};	


imsja
Posts: 4
Joined: 27 Jan 2010, 23:23

02 Feb 2010, 19:54

The problem could be fixed by downloading the correct PrimeFaces library primefaces-1.0.0.RC.jar. Before that I worked with ...SNAPSHOT version. Not it works as expected. Thanks for your help anyway.

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

04 Feb 2010, 14:31

Do you mean 1.0.0-RC snapshot or 1.0.0-snapshot?

yttesen
Posts: 51
Joined: 19 Feb 2010, 10:08

19 Feb 2010, 10:13

Hi,

Just developed my first touch app - great API!.

However I seem to run into the same issue as the creator of this thread. I'm using the primefaces-1.0.0.jar downloaded two days ago.

<i:view id="home" title="DSL - Mobile">
<h:form>
<i:tableView>
<i:rowGroup>
<i:rowItem value="Account" view="account" />
<i:rowItem value="Change password" view="changePassword" />
<i:rowItem value="Policy" view="policy" />
<i:rowItem value="Usage" view="usageDetails" actionListener="#{dslMobileBean.loadUsageDetails}" />
</i:rowGroup>
</i:tableView>
</h:form>
</i:view>

The "usageDetails" view is successfully rendered - but the action loadUsageDetails is not invoked.

Any suggestions?

Regards,
Christian
JDK: Java8
Primefaces: 4.0.13
OmniFaces: 1.5
JSF2: Mojarra 2.1.24
WebServer: Resin 4.0.38

yttesen
Posts: 51
Joined: 19 Feb 2010, 10:08

19 Feb 2010, 10:35

Seems like the update attribute is mandatory when using the actionListener. Is this the case? perhaps some warning/exception needs to be thrown if not present.

I got my actionListener called when the update attribute is present - great.
JDK: Java8
Primefaces: 4.0.13
OmniFaces: 1.5
JSF2: Mojarra 2.1.24
WebServer: Resin 4.0.38

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

19 Feb 2010, 14:03

I think we shouldn't do it mandatory, can you create a ticket for this in our issue tracker?

yttesen
Posts: 51
Joined: 19 Feb 2010, 10:08

22 Feb 2010, 07:29

JDK: Java8
Primefaces: 4.0.13
OmniFaces: 1.5
JSF2: Mojarra 2.1.24
WebServer: Resin 4.0.38

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

24 Feb 2010, 17:08

Great thanks, this will be fixed in upcoming release.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: imrankhurram and 69 guests