• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem wo loop WOHyperlink
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem wo loop WOHyperlink


  • Subject: Re: Problem wo loop WOHyperlink
  • From: Paul Hoadley <email@hidden>
  • Date: Sat, 14 Jul 2012 08:52:50 +0930

Hi Hugo,

On 14/07/2012, at 7:22 AM, Hugo Cambero wrote:

      <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>

---------------------------
DeleteLink : WOHyperlink {
    directActionName="
deleteRecord";
}

Change that to:

action = "">

And then add a method in your component class:

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() );       
    }

public WOActionResults deleteRecord() {
// This is just an example of what you might do—your business
// logic might require something else entirely.
entryItem.editingContext().deleteObject(entryItem);
entryItem.editingContext().saveChanges();
return context().page();
}

When a WOHyperlink's action method is called inside a WORepetition like that, the repetition's 'item' ivar will contain the value you would expect: the object from allUsers() that corresponds to the hyperlink that was clicked.


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem wo loop WOHyperlink (From: Hugo Cambero <email@hidden>)

  • Prev by Date: Re: Migrating from EOF to Cayenne
  • Next by Date: Re: Migrating from EOF to Cayenne
  • Previous by thread: Problem wo loop WOHyperlink
  • Next by thread: Re: Problem wo loop WOHyperlink
  • Index(es):
    • Date
    • Thread