On 30.11.2004 18:57, [EMAIL PROTECTED] wrote:
Hi guys (and gals),
Please help, I'm fiddling with this for the last week and I cannot get it to work properly.
Situation: I have a "bean" (it's rather complicated for a bean) that holds a map of lists that I want to edit in a repeater. I either get nothing displayed at all or I get it displayed but it fails to update.
What should be the correct syntax?
Childbean: appointmentBean (appointmentBean.date, appointmentBean.time, appointmentBean.person)
Rootbean: masterBean (masterBean.lists.appointments is the list of appointmentBean-s)
<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" path="/">
<fb:repeater id="appointments" parent-path="."
row-path="lists/appointments">
<fb:identity>
<fb:value id="ID" path="id/id"/>
</fb:identity>
<fb:on-bind>
<!-- executed on updates AND right after the insert -->
<fb:custom id="appointmentDate" path="date"/> <fb:custom id="appointmentTime" path="time"/> <fb:custom id="appointmentPerson" path="person"/> </fb:on-bind>
<fb:on-delete-row>
<fb:delete-node/>
</fb:on-delete-row>
<fb:on-insert-row>
<fb:insert-bean classname="AppointmentBean"
addmethod="add" /> </fb:on-insert-row>
</fb:repeater>
</fb:context>
What I want to do is add the new appointmentBean to the list of appointments, not to the root (i.e. masterBean). However, I need the above syntax to get the existing appointmentBeans displayed.
If I change it into <fb:repeater id="appointments" parent-path="lists/appointments"
row-path=".">
That one is wrong, the above one (parent-path pointing to root bean and row-path pointing to the list) is correct.
the "on-save" works, but the "on-load" doesn't do anything.
I can't think of anything else.
You don't as you have one correct solution ;-) The insert-bean specifies a method and its parameter you must have in the context. Your context is the root bean, so you need a method add(AppointmentBean ab) in your root bean. This method adds the new AppointmentBean to the list of appointments, something like:
public void add(AppointmentBean ab) {
this.lists.appointments.add(ab);
}When reading
What I want to do is add the new appointmentBean to the list of appointments, not to the root (i.e. masterBean).
I fear this is not exactly what you want, but I don't see another way. Where shall the method be placed in your ideal understanding?
Joerg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
