cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: checkbox widget with datatype vector
Date Tue, 25 Jul 2006 14:01:45 GMT
Andrew wrote:
> Hi Jason,
> first off I have to say I appreciate the time you put into helping me 
> grasp these concepts, much appreciated.
> 

No problem.

> 
> So how in flow do I add values to each of the widgets, (id, artistName, 
> etc etc etc), in the repeater, and then add that row to <ft:repeater-rows>?

Like I mentioned before, I think the easiest way to load data into the 
repeater is with a fb:simple-repeater binding.  I presume you're not 
familiar with the binding framework; it's basically a way to define (in 
an XML syntax) how to map values between a business object and the form 
object's widgets.  See the documentation: 
http://cocoon.apache.org/2.1/userdocs/binding.html

There's a special binding type called fb:simple-repeater (named such 
since it's much simpler than the full fb:repeater binding, but should be 
sufficient for your case) that lets you bind values from a Collection, 
Array, or anything else that JXPath can iterate over, to and from a 
fd:repeater widget and all its children.  Something like:

In a binding file:

...
<fb:simple-repeater id="items" parent-path="." row-path="orderItems"
                     direction="load">
   <fb:value id="id" path="ID" />
   <fb:value id="artistName" path="..." />
   ...
</fb:simple-repeater>
...

In your flow:

form.createBinding("path/to/binding-file.xml"); //creates the binding
...
form.load(neworder); //loads the data into the form using the binding

That's it.  You can call form.load() as many times in your flow as you 
want, such as after you delete items or a new item is added.  As long as 
the orderItems list contains the up-to-date list of items, the repeater 
will be updated to match.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message