users@woodstock.java.net

Hidden field for "remembering" an old value.

From: Q Beukes <quintin_at_last.za.net>
Date: Sun, 20 Jul 2008 16:13:06 -0700 (PDT)

Hey,

I have the following:
<webuijsf:table id="gridReaders" paginateButton="true"
paginationControls="true">
  <webuijsf:tableRowGroup binding="#{ConfigLamps.rgReaders}" id="rgReaders"
rows="10"
    sourceData="#{ConfigLamps.readers}" sourceVar="currentRow">
  <webuijsf:hiddenField binding="#{ConfigLamps.readerId}"
converter="#{ConfigLamps.integerConverter}"
    id="readerId" text="#{currentRow.value['id']}"/>
  <webuijsf:tableColumn sort="id">
    <webuijsf:textField binding="#{ConfigLamps.txtReaderID}"
converter="#{ConfigLamps.integerConverter}"
        id="txtReaderID" text="#{currentRow.value['id']}"
       
valueChangeListenerExpression="#{ConfigLamps.readerData_processValueChange}"/>
   </webuijsf:tableColumn>
  </webuijsf:tableRowGroup>
</webuijsf:table>

Then, ConfigLamps.readers source data binding is merely linked against a
"public Lamp[] getReaders()" method which returns a bunch of Lamp objects.
The object has a field "id" which I want to update using the text field.

I do the matching against the entity by getting the current row's
"readerId.getValue()", fetching a Lamp by this ID, and then updating it's
fields. I do this for all my tables.

It has worked so far to carry the primary key of the record in a hidden
field, but I have run into a problem where I want to update the primary key
field itself.

Since both the hidden and text field's have:
text="#{currentRow.value['id']}"
Whenever I change the value of the text field, the hidden field's binding
field also changes.

This is normal.

My question is
(1) Is there a better way of identifying the record I am busy with. For
instance, can I fetch row's object (which is referred to by currentRow. In
other words, can I get the currentRow's Lamp object.
(2) Is there a way to have the hidden field's value set by value, meaning it
isn't linked against the binding object?

Regarding the first question, I have checked around the RowKey object and
such, to see if I can get the bound object, but find no way to do this.

thanks
Quintin
-- 
View this message in context: http://www.nabble.com/Hidden-field-for-%22remembering%22-an-old-value.-tp18559843p18559843.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.