List and buttons

Last modified by Antoine Berry on 2013/04/25 05:02

Change default  buttons

When there's a list, you can choose which actions you're gonna perform on the selected entity by clicking on the related button. Usually you have 3 choices : inspect and edit on the left, and delete on the right. But if you're in an embedded list, you don't have any actions, however you might want to add an inspect button for instance. To do that you have the actions rule :

100 : pageConfiguration like 'ListEmbedded*' => actions = {"left" = ("inspectAction"); } [com.webobjects.directtoweb.Assignment]

Same problem, you don't want to show the edit button on a list :

100 : pageConfiguration like 'List*' => actions = {"left" = ("inspectAction"); "right" = ("deleteAction");} [com.webobjects.directtoweb.Assignment]

Add your custom buttons

The best thing is that you can add you custom buttons very easily using a pageController. If you don't know about that then you have to take a look at this page. Now that you know how to create your controller, you can add it to your list with the rule we've seen before :

100 : pageConfiguration like 'List*' => actions = {"left" = ("inspectAction", "controllerAction"); "right" = ("deleteAction");} [com.webobjects.directtoweb.Assignment]

You can write a method like this one below in your controller

public WOComponent copy(WOComponent sender){...}

Now you're able to copy your object directly from the list, without overriding any component.