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 ());
}
this shows '-1' ( !!!! ) Has it been deleted before this handler is called?
If I go :event.getSourceWidget ().getId () I get 'delete'.
If I go :event.getSourceWidget ().getParent ().getId () I get '-1'.
If I go :event.getSourceWidget ().getParent ().getParent ().getId () I get 'resources'.
Thanks for any suggestions
regards Jeremy
smime.p7s
Description: S/MIME cryptographic signature