Any way to update datalist in PF Mobile?

UI Components for JSF
Post Reply
allan_hkrs
Posts: 12
Joined: 13 Sep 2014, 04:23

29 Oct 2014, 09:18

Guys.. i'm trying a simple update in command button after execution, like we do in PF Web, referencing the "id's tree".. I tried everything (use firebug, reference all ids, use @parent..) No way... Please if anyone can help, i need to update datalist "entregasTable" in viewminhasentregas using commandbutton in viewcheckin...

I cutted the code to post here, if need entire, please let me know...

Thanks in advance

Code: Select all

<p:commandButton value="Checkin" action="#{mobileControllerBean.realizarCheckIn}" update=":viewminhasentregas"/>

Code: Select all

<pm:view id="viewminhasentregas">
		<pm:header title="" fixed="true" swatch="b">
			<f:facet name="left">
				<p:button value="Voltar" icon="back" href="#viewmenu" />
			</f:facet>
			<f:facet name="right">
				<p:button value="Sair" icon="home" href="#login" />
			</f:facet>
		</pm:header>
		<pm:content id="contententregas">
			<p:outputPanel id="panelentregas"  layout="block">
				<h3>Entregas designadas a Você:</h3>
				<p:dataList value="#{mobileControllerBean.entregas}" var="entrega"
					emptyMessage="Não existem entregas em Aberto, Andamento ou Atrasadas designadas para você neste momento"
					paginator="true" paginatorPosition="bottom" rows="10"
					paginatorAlwaysVisible="false" id="entregasTable">
					<p:commandLink action="#{mobileControllerBean.detalhesPreCheckIn(entrega.entregaID)}" update=":frmcheckin">
						<h2>Destinatário: #{entrega.destinatario}</h2>
						<h2>Status: #{entrega.statusDesc}</h2>
						<p>Empresa: #{entrega.empresa}</p>
						<p>#{entrega.endereco}, #{entrega.numero}
							(#{entrega.tipoEndereco})</p>
						<p>#{entrega.cidade} - #{entrega.estado}</p>
					</p:commandLink>
				</p:dataList>
			</p:outputPanel>
		</pm:content>
	</pm:view>
Not simplified:

Code: Select all

	<pm:view id="viewminhasentregas">
		<pm:header title="" fixed="true" swatch="b">
			<f:facet name="left">
				<p:button value="Voltar" icon="back" href="#viewmenu" />
			</f:facet>
			<f:facet name="right">
				<p:button value="Sair" icon="home" href="#login" />
			</f:facet>
		</pm:header>
		<pm:content id="contententregas">
			<p:outputPanel id="panelentregas"  layout="block">
				<h3>Entregas designadas a Você:</h3>
				<p:dataList value="#{mobileControllerBean.entregas}" var="entrega"
					emptyMessage="Não existem entregas em Aberto, Andamento ou Atrasadas designadas para você neste momento"
					paginator="true" paginatorPosition="bottom" rows="10"
					paginatorAlwaysVisible="false" id="entregasTable">
					<p:commandLink action="#{mobileControllerBean.detalhesPreCheckIn(entrega.entregaID)}" update=":frmcheckin">
						<h2>Destinatário: #{entrega.destinatario}</h2>
						<h2>Status: #{entrega.statusDesc}</h2>
						<p>Empresa: #{entrega.empresa}</p>
						<p>#{entrega.endereco}, #{entrega.numero}
							(#{entrega.tipoEndereco})</p>
						<p>#{entrega.cidade} - #{entrega.estado}</p>
					</p:commandLink>
				</p:dataList>
			</p:outputPanel>
		</pm:content>
	</pm:view>

	<pm:view id="viewcheckin">
		<pm:header title="" fixed="true" swatch="b">
			<f:facet name="left">
				<p:button value="Voltar" icon="back" href="#viewminhasentregas" />
			</f:facet>
			<f:facet name="right">
				<p:button value="Sair" icon="home" href="#login" />
			</f:facet>
		</pm:header>
		<pm:content>
			<div align="center">
				<h:form id="frmcheckin">
					<p:outputLabel value="#{mobileControllerBean.dataAtual}" style="font-weight: 900">
						<f:convertDateTime dateStyle="full" />
					</p:outputLabel>
					<br/>
					<p:separator />
					<pm:field>
						<p:outputLabel value="Status da Entrega: " style="margin-top: 50px; font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.statusCod} - #{mobileControllerBean.entregaSelecionada.statusDesc}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Código da Entrega: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.entregaID}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Data de Abertura: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.abertoDate}">
							<f:convertDateTime pattern="dd/MM/yyyy HH:mm" />
						</p:outputLabel>
					</pm:field>
					<pm:field>
						<p:outputLabel value="Tempo Estimado para Entrega: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.tempoEstimado} minutos" />
					</pm:field>
					<p:separator />
					<pm:field>
						<p:outputLabel value="Destinatário: " style="margin-top: 50px; font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.destinatario}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Empresa: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.empresa}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Endereço " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.endereco}, #{mobileControllerBean.entregaSelecionada.numero} (#{mobileControllerBean.entregaSelecionada.tipoEndereco})" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Complemento: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.complemento}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="CEP: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.cep}" />
					</pm:field>
					<pm:field>
						<p:outputLabel value="Telefone: " style="font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.telefone}" />
					</pm:field>
					<p:separator/>
					<pm:field>
						<p:outputLabel value="Observações: " style="margin-top: 50px; font-weight: 700" />
						<p:outputLabel value="#{mobileControllerBean.entregaSelecionada.observacaoCadastro}" />
					</pm:field>
				</h:form>
				<h:form>
					<p:commandButton value="Checkin" action="#{mobileControllerBean.realizarCheckIn}" update=":viewminhasentregas"/>
				</h:form>
			</div>
		</pm:content>
	</pm:view>

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

29 Oct 2014, 12:36

if you have

form (with id="...") -> pm:view -> pm:content -> p:outputPanel

Code: Select all

<p:outputPanel id="panelentregas"  layout="block">
then you should be able to do

Code: Select all

update=":formID:panelentregas"
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

allan_hkrs
Posts: 12
Joined: 13 Sep 2014, 04:23

29 Oct 2014, 15:01

smithh032772 wrote:if you have

form (with id="...") -> pm:view -> pm:content -> p:outputPanel

Code: Select all

<p:outputPanel id="panelentregas"  layout="block">
then you should be able to do

Code: Select all

update=":formID:panelentregas"

Smith, isnt the case, i have:

<pm:page> -> <pm:view> -><pm:content> -><p:outputPanel> -> <p:dataList>

i tried to do what you said (pm:view -> p:outputPanel), but didnt work (IllegalArgumentException)... Any other idea?

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

29 Oct 2014, 16:00

allan_hkrs wrote:i have:

Code: Select all

<pm:page> -> <pm:view> -><pm:content> -><p:outputPanel> -> <p:dataList>
why you have that? did you read PrimeFaces 5.x user guide, and see that pm:view has been deprecated?

Per PrimeFaces 5.x user guide, 10.2 Pages,

Code: Select all

<!DOCTYPE html>
<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:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile">
<f:view renderKitId="PRIMEFACES_MOBILE" />
<h:head>
</h:head>
<h:body>
<pm:page>
<pm:header title="Basic Page"></pm:header>
<pm:content></pm:content>
</pm:page>
</h:body>
</html>
pm:view is no longer there

what you need to do, is find the following in your browser, and reply here with the ID of the <div> for the following:

Code: Select all

<p:outputPanel id="panelentregas"  layout="block">
and then use that in your update="..."; put ':' (colon) at the beginning of your update="..."
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests