You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2016/09/22 01:02:18 UTC

beaneditform with option lists of objects

Hi all,

I have tables:
Parent
------------------
parent_id
child_id

Child
---------------
child_id

and ORM entity:

Parent
---------------
Long Id
Child child (oneToOne in this case, joinColumn child_id)

Child is another ORM entity. Child could be one of many options from the 
database.

I would like a form for editing Parent which using a <select> allows the 
selection of one Child from all of the Child options.

What is the easiest way to integrate this model with BeanEditForm or 
failing that, BeanEditor?

Thanks, Paul.

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


Re: beaneditform with option lists of objects

Posted by Barry Books <tr...@gmail.com>.
You will need to build a select model for your list

http://tapestry.apache.org/using-select-with-a-list.html

I would create an Interface and have the child implement it so you can
create a generic one

Then create an edit block out of that code. This will allow the BeanEditor
to edit this kind of list with your edit block

Lastly since the type is likely list or set you will need to annotate the
field with @Datatype so the bead editor can figure out what block to use to
edit the field. You might be able to write a data type analyzer to figure
this out without @Datatype but Java's type erasure makes this a bit
difficult.

It sounds like a lot of work but once you've done one it gets easier. Also
if you create a generic select model you'll only need one.

On Wednesday, September 21, 2016, Paul Stanton <pa...@mapshed.com.au> wrote:

> Hi all,
>
> I have tables:
> Parent
> ------------------
> parent_id
> child_id
>
> Child
> ---------------
> child_id
>
> and ORM entity:
>
> Parent
> ---------------
> Long Id
> Child child (oneToOne in this case, joinColumn child_id)
>
> Child is another ORM entity. Child could be one of many options from the
> database.
>
> I would like a form for editing Parent which using a <select> allows the
> selection of one Child from all of the Child options.
>
> What is the easiest way to integrate this model with BeanEditForm or
> failing that, BeanEditor?
>
> Thanks, Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>