Hi Alex,
Maybe the problem lies in the use of <html><head><body> and also <tr:document>.
The <tr:document> tag also inserts a <html> etcetera into your page.
If that does not solve it, here is an example of what i have done in a similar
case.
Example page contains a customer table and an order table. The order table is
refreshed is a particular row of the customer table is being selected
<f:view>
<tr:document title="#{res['customer.title']}">
<h:form>
<tr:panelPage>
...
<tr:panelHeader text="#{res['customer.title']}">
<tr:table id="tablecustomer" value="#{customerorder.customers}"
var="customer" rowBandingInterval="1"
rows="5" rowSelection="single"
binding="#{customerorder.tableCustomer}"
emptyText="#{res['info.no.rows']}"
selectionListener="#{customerorder.customerSelectionListener}"
autoSubmit="true">
<tr:column headerText="#{res['customer.name']}" sortable="true"
sortProperty="name">
<tr:outputText value="#{customer.name}"/>
</tr:column>
...
</tr:table>
</tr:panelHeader>
<tr:panelHeader id="panelheaderorder" text="#{res['order.title']} by
#{customerorder.selectedCustomer.name}"
partialTriggers="tablecustomer">
<tr:table id="tableorder" value="#{customerorder.bestellingen}"
var="bestelling" rowBandingInterval="1"
emptyText="#{res['info.no.rows']}"
partialTriggers="::tablecustomer">
<tr:column headerText="#{res['order.orderdate']}" sortable="true"
sortProperty="orderDate">
<tr:outputText value="#{bestelling.orderDate}">
<f:converter converterId="dateconverter"/>
</tr:outputText>
</tr:column>
...
</tr:table>
</tr:panelHeader>
</tr:panelPage>
</h:form>
</tr:document>
</f:view>
The selection listener looks as follows
public void customerSelectionListener(SelectionEvent selectionEvent) {
selectedCustomer = (Customer)tableCustomer.getSelectedRowData();
bestellingen = selectedCustomer.getBestellingen();
}
This picks up the selected row and gets the orders belonging to that row. The
bold faced text is the relevant part. The bold-italic is also represented in
the selection listener.
Actually you can leave out the ::, you just get a warning. The :: excludes this
naming container and its children in the process of looking from a
corresponding ID.
Hope this is of any help to you
-----Original Message-----
From: alex01130 [mailto:[email protected]]
Sent: Mon 12/22/2008 21:12 PM
To: MyFaces Discussion
Cc:
Subject: Re: Trinidad1.0.10: How to refresh a table after rowSelection
Dear René,
thanks for your quick response. Unfortunally I can't get a refresh
trying
your advise. Maybe I made some mistake.
My complete page is:
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<f:view>
<body>
<tr:document>
<h:form>
<tr:table id="custab" value="#{customerBean.all}" var="currentCustomer"
rowBandingInterval="1" rowSelection="single" autoSubmit="true"
selectionListener="#{customerBean.selectEvent}">
<tr:column sortProperty="userid" sortable="true" headerText="Id">
<h:outputText value="#{currentCustomer.userid}"></h:outputText>
</tr:column>
<tr:column sortProperty="username" sortable="true"
headerText="Username">
<h:outputText value="#{currentCustomer.username}"></h:outputText>
</tr:column>
</tr:table>
<tr:table id="gpstab" partialTriggers="::custab ::b1"
value="#{customerBean.allGps}" var="currentGps"
rowBandingInterval="1" rowSelection="single" autoSubmit="true"
selectionListener="#{customerBean.selectGpsEvent}">
<tr:column sortProperty="gpsid" sortable="true" headerText="GpsId">
<h:outputText value="#{currentGps.gpsid}"></h:outputText>
</tr:column>
<tr:column sortProperty="userid" sortable="true" headerText="UserId">
<h:outputText value="#{currentGps.userid}"></h:outputText>
</tr:column>
<tr:column sortProperty="gpsname" sortable="true" headerText="Gpsname">
<h:outputText value="#{currentGps.gpsname}"></h:outputText>
</tr:column>
<tr:column sortProperty="gpsphone" sortable="true"
headerText="GpsPhone">
<h:outputText value="#{currentGps.gpsphone}"></h:outputText>
</tr:column>
</tr:table>
As you can see I have defined 2 Triggers for test-purposes. Button
trigger
works fine, row selection as trigger doesn't work. Defining the row
selection trigger without at least one ":" yields to a runtime error:
"use
the correct syntax" or so.
Do you have any suggestions whats wrong?
Thanks in advance
Alex Georg
----- Original Message -----
From: "René van Wijk" <[email protected]>
To: "MyFaces Discussion" <[email protected]>
Sent: Monday, December 22, 2008 9:18 AM
Subject: RE: Trinidad1.0.10: How to refresh a table after rowSelection
> Use an ID on the first and partialTriggers on the second, i.e.
>
> <tr:table id="first" ....
>
> <tr:table id="second" partialTriggers="first" ....
>
> -----Original Message-----
> From: alex01130 [mailto:[email protected]]
> Sent: Fri 12/19/2008 19:58 PM
> To: [email protected]
> Cc:
> Subject: Trinidad1.0.10: How to refresh a table after rowSelection
>
>
> Hi, I have a rather simple problem, but I don't how to fix it:
>
> I have 2 tables which are related and I need a refresh of the of the
second one, if a user selects a row of the first :
>
> <tr:table value="#{customerBean.all}" var="currentCustomer"
>
> rowBandingInterval="1" rowSelection="single"
autoSubmit="true"
selectionListener="#{customerBean.selectEvent}">
>
> <tr:column sortProperty="userid"
sortable="true" headerText="Id">
>
> <h:outputText
value="#{currentCustomer.userid}"></h:outputText>
>
> </tr:column>
>
> <tr:column sortProperty="username" sortable="true"
headerText="Username">
>
> <h:outputText
value="#currentCustomer.username}"></h:outputText>
>
> </tr:column>
>
> </tr:table>
>
>
>
>
>
> <tr:table id="gpstab" value="#{customerBean.allGps}"
var="currentGps"
>
> rowBandingInterval="1" rowSelection="single" autoSubmit="true"
selectionListener="#{customerBean.selectGpsEvent}">
>
> <tr:column sortProperty="gpsid" sortable="true"
headerText="GpsId">
>
> <h:outputText
value="#{currentGps.gpsid}"></h:outputText>
>
> </tr:column>
>
> <tr:column sortProperty="userid" sortable="true"
headerText="UserId">
>
> <h:outputText
value="#{currentGps.userid}"></h:outputText>
>
> </tr:column>
>
> <tr:column sortProperty="gpsname" sortable="true"
headerText="Gpsname">
>
> <h:outputText
value="#{currentGps.gpsname}"></h:outputText>
>
> </tr:column>
>
> <tr:column sortProperty="gpsphone" sortable="true"
headerText="GpsPhone">
>
> <h:outputText value="#
{currentGps.gpsphone}"></h:outputText>
>
> </tr:column>
>
> </tr:table>
>
>
> If a row in the first table is selected, the event procedure is
called,
customerBean.all and customerBean.allGps are preformed by autosubmit,
but
the tables are not refreshed.
>
> Any ideas, how I can get a table refresh without using an unnecessary
submit-button on the page.
>
> Thanks in advance,
>
> Alex Georg
>
>
>
<<winmail.dat>>

