You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marc Portier <mp...@outerthought.org> on 2004/05/05 09:20:55 UTC

Re: What does the repeater's method do?? --- getWidget(String id)


Christina wrote:

> As I know a repeater has many rows and each row is made up of the same 
> set of widgets.
> But this method in the repeater class doesn't set a row parameter, only 
> an id to return a "child"  widget
> so which widget does it return?

the getWidget on the repeater wraps around it's getRow

the id you pass will be interpreted as an integer and used as an index
of the row

as such the returned object is of type Repeater.RepeaterRow (an inner
class of repeater)

on that repeater-row a getWidget() will return the various widgets
you've defined

this might be a bit confusing but you have to understand that the
repeater-definition just shows you only one dimension: i.e. the various
'columns'
at run time the 'rows' dimenstion needs to be added to build a full table

if you check the generated HTML form you find an extra indication of
these two dimensions in the fact that the distinct input element's get
names like contacts.0.name

where contacts --> repeater
contacts.0 --> first row of the repeater
contacts.0.name --> the name-box in the first row

-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

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