myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JeroenM <jeroenmeijer8...@hotmail.com>
Subject Issues when using Facelets
Date Thu, 09 Jul 2009 14:24:10 GMT

Hi, 

I'm having trouble with a <h:selectOneRadio> . I have two pages divided into
two parts; top part being some input text boxes for the query parameters,
bottom part a result list with a selectOneRadio to select a row (and further
on display some details).

When using it in a dialog: the beans valueChangedListener gets called
without any trouble or additionional javascript submit(); because the dialog
doesn't use any Facelets tag

<trh: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:trh="http://myfaces.apache.org/trinidad/html"
	xmlns:tr="http://myfaces.apache.org/trinidad"
	xmlns:f="http://java.sun.com/jsf/core">
<trh:head>
	<script type="text/javascript" src="../js/global.js"></script>
</trh:head>
<trh:body>
    <tr:form>
	<trh:tableLayout>
		<trh:rowLayout>
			<trh:cellFormat>
				<tr:outputLabel for="land" value="Land" />
			</trh:cellFormat>
			<trh:cellFormat>
				<tr:inputText id="land" value="#{pickLand.zoekString}" />
			</trh:cellFormat>
			<trh:cellFormat>
				<h:commandButton value="Zoeken"
				actionListener="#{pickLand.zoeken}" />
			</trh:cellFormat>
		</trh:rowLayout>
	</trh:tableLayout>

	<h:dataTable binding="#{pickLand.dataTable}" value="#{pickLand.items}"
styleClass="itemClass"
		headerClass="headerClass" var="currentItem">
		<h:column>
			<f:facet name="header">Code</f:facet>
			<h:selectOneRadio styleClass="none"
				valueChangeListener="#{pickLand.setSelectedItem}"
				onclick="dataTableSelectOneRadio(this);">
				<f:selectItem itemValue="#{currentItem.id}"/>
			</h:selectOneRadio>
		</h:column>
		<h:column>
			<f:facet name="header">Landnaam</f:facet>
			<h:outputText value="#{currentItem.naam}" />
		</h:column>
	</h:dataTable>

	<tr:commandButton text="Submit" action="#{pickLand.save}" />
	<tr:commandButton text="Cancel" action="#{pickLand.cancel}" />
   </tr:form>
</trh:body>
</trh:html>


However I also have a page which includes ui:composition tags. Because of
this the generated page output is different. The javascript function which
toggles the radiobutton gets called, however the valueChangedListener doesnt
get called. Only if I supply an additional onclick=submit() the
valueChangedListener gets called, but as a side effect the entire page will
be flushed. Is there any way (or documentation) to do this without the page
being reloaded? 

<!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:tr="http://myfaces.apache.org/trinidad"
	xmlns:trh="http://myfaces.apache.org/trinidad/html"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
<f:view>
     <ui:composition template="/facelets/template.xhtml">
	<ui:define name="content">
	<script type="text/javascript" src="../js/global.js"></script>

	<h3>Zoeken VIP</h3>
	<tr:form>
		<trh:tableLayout>
			<trh:rowLayout>
				<trh:cellFormat>
					<tr:outputLabel for="vipnummer" value="VIP nummer" />
				</trh:cellFormat>
				<trh:cellFormat>
					<tr:inputText id="vipnummer"
						value="#{zoekenVIP.persoon.vipnummer}" />
				</trh:cellFormat>
			</trh:rowLayout>
			<trh:rowLayout>
				<trh:cellFormat>
					<tr:outputLabel for="gbanummer" value="GBA nummer" />
				</trh:cellFormat>
				<trh:cellFormat>
					<tr:inputText id="gbanummer"
						value="#{zoekenVIP.persoon.gbanummer}" />
				</trh:cellFormat>
			</trh:rowLayout>
			<trh:rowLayout>
				<trh:cellFormat>
					<tr:outputLabel for="jaargeboorte" value="Jaar geboorte" />
				</trh:cellFormat>
				<trh:cellFormat>
					<tr:inputText id="jaargeboorte"
						value="#{zoekenVIP.persoon.jaargeboorte}" />
				</trh:cellFormat>
			</trh:rowLayout>
			<trh:rowLayout>
				<trh:cellFormat>
					<tr:outputLabel for="geboortegemeente" value="Geboorte gemeente" />
				</trh:cellFormat>
				<trh:cellFormat>
					<tr:inputText id="geboortegemeente"
						value="#{zoekenVIP.persoon.geboortegemeente}"
						partialTriggers="btnZoekGemeente" />
				</trh:cellFormat>
				<trh:cellFormat>
					<tr:commandButton text="LOV" id="btnZoekGemeente"
						useWindow="true" partialSubmit="true"
						action="dialog:pickGemeente"
						returnListener="#{zoekenVIP.handleGemeente}" />
				</trh:cellFormat>
			</trh:rowLayout>
		</trh:tableLayout>

		<h:commandButton value="Nieuw" actionListener="#{zoekenVIP.nieuw}" />
		<h:commandButton value="Zoeken" actionListener="#{zoekenVIP.zoeken}"
					action="next" />

		<h:dataTable binding="#{zoekenVIP.dataTable}"
			value="#{zoekenVIP.items}" styleClass="itemClass"
			headerClass="headerClass" var="currentItem">
			<h:column>
				<f:facet name="header">Code</f:facet>
				<h:selectOneRadio styleClass="none"
					valueChangeListener="#{persoonsGegevens.setSelectedItem}"
					onclick="dataTableSelectOneRadio(this);">
					<f:selectItem itemValue="#{currentItem.vipnummer}" />
				</h:selectOneRadio>
			</h:column>
			<h:column>
				<f:facet name="header">VIP Nummer</f:facet>
				<h:outputText value="#{currentItem.vipnummer}" />
			</h:column>
			<h:column>
				<f:facet name="header">Achternaam</f:facet>
				<h:outputText value="#{currentItem.achternaam}" />
			</h:column>
		</h:dataTable>
	</tr:form>
             </ui:define>
</ui:composition>
</f:view>
</html>

-- 
View this message in context: http://www.nabble.com/Issues-when-using-Facelets-tp24410595p24410595.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message