On 27 Nov 2003, at 16:32, Bruno Dumon wrote:
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).
Except is is useless in these circumstances, because the row has already been deleted, the value is '-1'.
regards Jeremy
smime.p7s
Description: S/MIME cryptographic signature
