Wiki source code of List and buttons
Last modified by Antoine Berry on 2013/04/25 05:02
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | == Change default buttons == | ||
2 | |||
3 | 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 : | ||
4 | |||
5 | {{code language="none"}} | ||
6 | 100 : pageConfiguration like 'ListEmbedded*' => actions = {"left" = ("inspectAction"); } [com.webobjects.directtoweb.Assignment] | ||
7 | {{/code}} | ||
8 | |||
9 | Same problem, you don't want to show the edit button on a list : | ||
10 | |||
11 | {{code language="none"}} | ||
12 | 100 : pageConfiguration like 'List*' => actions = {"left" = ("inspectAction"); "right" = ("deleteAction");} [com.webobjects.directtoweb.Assignment] | ||
13 | {{/code}} | ||
14 | |||
15 | == Add your custom buttons == | ||
16 | |||
17 | 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>>doc:documentation.Home.Development Architecture.DirectToWeb Architecture.Direct To Web (D2W and ERD2W).D2W Flow Control.WebHome]]. Now that you know how to create your controller, you can add it to your list with the rule we've seen before : | ||
18 | |||
19 | {{code language="none"}} | ||
20 | 100 : pageConfiguration like 'List*' => actions = {"left" = ("inspectAction", "controllerAction"); "right" = ("deleteAction");} [com.webobjects.directtoweb.Assignment] | ||
21 | {{/code}} | ||
22 | |||
23 | You can write a method like this one below in your controller | ||
24 | |||
25 | {{code language="java"}} | ||
26 | public WOComponent copy(WOComponent sender){...} | ||
27 | {{/code}} | ||
28 | |||
29 | Now you're able to copy your object directly from the list, without overriding any component. |