cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: deleting repeater-rows
Date Thu, 27 Nov 2003 16:32:34 GMT
On Thu, 2003-11-27 at 17:29, Bruno Dumon wrote:
> On Thu, 2003-11-27 at 13:37, Jeremy Quinn wrote:
> > On 26 Nov 2003, at 18:19, Bruno Dumon wrote:
> > 
> > >
> > >>
> > >> How do I call delete on my bean?
> > >> 	I am using Hibernate, it is not enough to just remove the item from
> > >> the Collection, I also need to call session.delete (resource) (or more
> > >> accurately ResourcePeer.delete (session, resource), so it is wrapped 
> > >> in
> > >> a Transaction) on the deletee.
> > >
> > > Simply execute this code from an event-handler attached to the button?
> > >
> > 
> > Now I am having a problem identifying which row is being deleted.
> > 
> > in my Model :
> > 
> > <wd:repeater id="resources">
> >    <wd:widgets>
> >      <wd:output id="id">
> >        <wd:datatype base="long"/>
> >      </wd:output>
> >      . . .
> >      <wd:row-action id="delete" action-command="delete">
> >        <wd:label><i18n:text 
> > i18n:catalogue="local">label.delete.resource</i18n:text></wd:label>
> >        <wd:hint><i18n:text 
> > i18n:catalogue="local">hint.delete.resource</i18n:text></wd:hint>
> >        <wd:on-activate>
> >          <javascript>deleteRow (event)</javascript>
> >        </wd:on-activate>
> >      </wd:row-action>
> >    </wd:widgets>
> > </wd:repeater>
> > 
> > in my Binding :
> > 
> > <wb:repeater id="resources"
> >    parent-path="."
> >    row-path="resources"
> >    unique-row-id="id"
> >    unique-path="id">
> > 
> >    <wb:on-bind>
> >      <wb:value id="id" path="id"/>
> >      . . .
> >    </wb:on-bind>
> > 
> >    <wb:on-insert-row>
> >      <wb:insert-bean
> >        classname="uk.co.my.bean.Resource"
> >        addmethod="addResource"/>
> >      </wb:on-insert-row>
> > 
> >    <wb:on-delete-row>
> >      <wb:delete-node/>
> >    </wb:on-delete-row>
> > 
> > </wb:repeater>
> > 
> > in my FløwScript :
> > 
> > // event handler called by Woody to remove a Resource Row from the Album
> > function deleteRow (event) {
> > 	// get the ID of the Resource that is being deleted, so I can remove 
> > it from the Persistor
> > 	cocoon.log.info ("User deleting Row :" + event.getSourceWidget 
> > ().getParent ().getId ());
> 
> I don't think this will return the id you expect. The id returned by
> getId() is the id of the widget as defined in the form definition, not
> to be confused with the unique-row-id from the binding, which just
> points to a widget who's value is used as unique row identification.

oops, was confused for a while, the getId() on the row will indeed
return the row number (as a string).

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Mime
View raw message