Hi Simon,
 
I apologize for the slow response, I was on vacation all last week and just checked my email yesterday.  I really appreciate your help, and I've got some more questions if you wouldn't mind taking a look.  My responses are below in bold type.
 
Thanks,
 
Susan

Simon Kitching <[EMAIL PROTECTED]> wrote:

Volker Weber wrote:
> Hi Susan,
>
> Susan Cline wrote:
>> Hi,
>>
>> Here's the use of the saveState in the FlightList.jsp
>> file:
>>
>>
>>
>>
>> Within this page I'm using a datatable to get the
>> available flights in the flightConfig bean:
>>
>> >> headerClass="standardTable_Header"
>> footerClass="standardTable_Header"
>> rowClasses="standardTable_Row1,standardTable_Row2"
>>
>> columnClasses="standardTable_ColumnCentered,standardTable_ColumnCentered,standardTable_ColumnCentered,standardTable_ColumnCentered,standardTable_ColumnCentered"
>> var="flight" value="#{flightConfig.availableFlights}"
>> preserveDataModel="false" rows="5">
>>
>>
>>
>>
>>

>>
>
> the saveState tag does not work for the datatables local variable
> 'flight'. This bean is set into request(?) by the datatable before
> processing each row and i think it should removed after then.
> Did you get an exception when accessing the 'flight' bean on your
> CreditCard.jsp page?

Ahh .. I didn't see that #{flight} is the "row variable" for the table.
Yes, I agree with Volker that this won't work; that variable only exists
while the row is being rendered.

Are you trying to figure out which row was selected when the link was
clicked? If so, you can do this by accessing the table component or the
DataModel of that table from the #{flight.selectedFlight} method.

Yes, I am.  Okay, this makes sense.

Is method #{flightConfig.availableFlights} returning a DataModel object?
If so, then in your #{flight.selectedFlight} method you just need to ask
that DataModel object what the current row is by calling getRowData() or
getRowIndex(). This works because the link is "immediate". The table
repeats the following for each row:
* set row index
* ask all children of the table to process themselves
When the row with the clicked link is processed, the action callback is
executed - and the table's rowIndex (and thus rowData) field is
referring to the row that is being processed.

 

No, it is not.  I tried to do it that way yesterday and was not successful.

If you're just returning a List from that method and allowing the table
component to automatically create a DataModel wrapper for the list then
you will instead need to get access to the table by specifying a
"binding" attribute, eg binding="#{flightConfig.table}". Method
FlightConfig.setTable(UIData component) will then be called so that your
backing bean gets a reference to the table component.

 

It is returning a List.  Today I have tried doing it this way, but am still having a problem.  Let me explain what I've done.  For the datatable I added the binding you suggested in my FlightList.jsp:

 

(Style class stuff omitted)

 

<t:dataTable id="data" var="flight" value="#{flightConfig.availableFlights}" binding="#{flightConfig.table}" preserveDataModel="true" rows="5">

 

Now, in the FlightConfigurator managed bean (flightConfig) I added a private member UIData (I had to make it transient, otherwise I got a NotSeriablizable exception ??):

 

private transient UIData table;

 

....

 

 public void setTable(UIData component) {
  table = component;
  
 }
 
 public UIData getTable() {
  return table;
 }

 

Now in CreditCard.jsp I'm trying to get the Row Data related to the HtmlDataTable using this syntax:

 

<h:outputText value="this is the flight: #{flightConfig.table.getRowData}"/>

But this doesn't work, I get this error:

 

Nov 29, 2005 10:29:04 AM org.apache.myfaces.renderkit.RendererUtils getStringValue

SEVERE: Property not found - called by component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /flights/CreditCard.jsp][Class: javax.faces.component.html.HtmlOutputText,Id: _id3]}

 

Can I access the HtmlDataTable values using EL like this?  If not, how can I get the value displayed in CreditCard.jsp?

 

Thanks,

 

Susan



I hope this helps.

Regards,

Simon

Reply via email to