Hi Hugo, You could use a Component Action rather than a Direct Action in your WOHyperlink.
.wod
DeleteLink : WOHyperlink {
action = deleteRecord;
}
The deleteRecord() method in your component class would need to:
* call delete on your entryItem enterprise object
* call saveChanges on your editingContext
* return a WOComponent or WOActionResults implementation, eg context().page()
Sharpy..
On 14/07/2012, at 7:52 AM, Hugo Cambero wrote:
> Hi Everybody
>
> I'm Hugo, I've been developing using WebObjects and Wonder Frameworks, I'm
> newbie in this topic.
>
> I have a problem and I hope you can help me. I'm developing a test
> application, I want to display a list of ERXGenericRecord, but, in the last
> column,
> I want to display a picture that can delete the selected row.
>
> Example:
>
> ID NAME LASTNAME USERNAME ACTIONS
> 120 Hugo Perez sun13 delete
> 160 Aaron Anthony aaron12 delete
>
> If the user clicks the delete picture of the first row, the application
> deletes the record 120.
>
> I'm trying to do it using the next code:
>
> <table>
> <tr>
> <td>ID</TD>
> <td>Name</td>
> <td>Lastname</td>
> <td>Username</td>
> <td>Actions</td>
> </tr>
> <wo:loop list="$allUsers" item="$entryItem">
> <tr>
> <td>
> <wo:str value="$entryItem.primaryKey" />
> </td>
> <td>
> <wo:str value="$entryItem.name" />
> </td>
> <td>
> <wo:str value="$entryItem.lastname" />
> </td>
> <td>
> <wo:str value="$entryItem.username" />
> </td>
> <td>
> <webobject name = "DeleteLink" >
> <webobject name = "DeleteImage"/>
> </webobject>
> </td>
> </tr>
> </wo:loop>
> </table>
> ---------------------------
> DeleteLink : WOHyperlink {
> directActionName="deleteRecord";
> }
>
> DeleteImage : WOImage {
> filename = "css/img/boton/delete.png";
> mimeType="image/gif";
> }
> --------------------------
> package your.app.components;
>
> import your.app.model.User;
> import com.webobjects.appserver.WOContext;
> import com.webobjects.foundation.NSArray;
> import er.extensions.components.ERXComponent;
> import er.extensions.eof.ERXEC;
>
> public class AdminPage extends ERXComponent {
> private User entryItem;
>
> public AdminPage(WOContext context) {
> super(context);
> }
>
> public User entryItem() {
> return entryItem;
> }
>
> public void setEntryItem(User entryItem) {
> this.entryItem = entryItem;
> }
>
> public NSArray<User> allUsers() {
> return User.fetchAllUsers( ERXEC.newEditingContext() );
> }
> }
>
> I think, I can solve this problem, adding a key or data in GET method in the
> 'Delete Link', but, I don't know.
> What do you recommend me?
> What is the best way to do this exercise?
>
> Thanks!
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com
>
> This email sent to [email protected]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
