You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cookbook/event_navigation/frontend.md
+61-10Lines changed: 61 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,28 +14,39 @@ The following frontend events are available:
14
14
```abap
15
15
CONSTANTS:
16
16
BEGIN OF cs_event,
17
+
18
+
"Framework
17
19
popup_close TYPE string VALUE `POPUP_CLOSE`,
18
-
open_new_tab TYPE string VALUE `OPEN_NEW_TAB`,
19
20
popover_close TYPE string VALUE `POPOVER_CLOSE`,
20
-
location_reload TYPE string VALUE `LOCATION_RELOAD`,
21
-
nav_container_to TYPE string VALUE `NAV_CONTAINER_TO`,
22
-
nest_nav_container_to TYPE string VALUE `NEST_NAV_CONTAINER_TO`,
23
-
nest2_nav_container_to TYPE string VALUE `NEST2_NAV_CONTAINER_TO`,
21
+
set_size_limit TYPE string VALUE `SET_SIZE_LIMIT`,
22
+
set_odata_model TYPE string VALUE `SET_ODATA_MODEL`,
24
23
cross_app_nav_to_ext TYPE string VALUE `CROSS_APP_NAV_TO_EXT`,
25
24
cross_app_nav_to_prev_app TYPE string VALUE `CROSS_APP_NAV_TO_PREV_APP`,
26
-
popup_nav_container_to TYPE string VALUE `POPUP_NAV_CONTAINER_TO`,
27
-
download_b64_file TYPE string VALUE `DOWNLOAD_B64_FILE`,
28
-
set_size_limit TYPE string VALUE `SET_SIZE_LIMIT`,
25
+
26
+
"Actions
27
+
clipboard_copy TYPE string VALUE `CLIPBOARD_COPY`,
28
+
clipboard_app_state TYPE string VALUE `CLIPBOARD_APP_STATE`,
29
29
set_title TYPE string VALUE `SET_TITLE`,
30
30
set_title_launchpad TYPE string VALUE `SET_TITLE_LAUNCHPAD`,
31
31
set_focus TYPE string VALUE `SET_FOCUS`,
32
32
scroll_to TYPE string VALUE `SCROLL_TO`,
33
33
scroll_into_view TYPE string VALUE `SCROLL_INTO_VIEW`,
34
34
start_timer TYPE string VALUE `START_TIMER`,
35
35
keyboard_set_mode TYPE string VALUE `KEYBOARD_SET_MODE`,
36
-
clipboard_copy TYPE string VALUE `CLIPBOARD_COPY`,
37
-
clipboard_app_state TYPE string VALUE `CLIPBOARD_APP_STATE`,
36
+
open_new_tab TYPE string VALUE `OPEN_NEW_TAB`,
37
+
location_reload TYPE string VALUE `LOCATION_RELOAD`,
38
+
system_logout TYPE string VALUE `SYSTEM_LOGOUT`,
39
+
download_b64_file TYPE string VALUE `DOWNLOAD_B64_FILE`,
40
+
urlhelper TYPE string VALUE `URLHELPER`,
38
41
history_back TYPE string VALUE `HISTORY_BACK`,
42
+
store_data TYPE string VALUE `STORE_DATA`,
43
+
play_audio TYPE string VALUE `PLAY_AUDIO`,
44
+
45
+
"Control calls (whitelisted, positional t_arg)
46
+
control_by_id TYPE string VALUE `CONTROL_BY_ID`,
47
+
control_global TYPE string VALUE `CONTROL_GLOBAL`,
48
+
binding_call TYPE string VALUE `BINDING_CALL`,
49
+
39
50
END OF cs_event.
40
51
```
41
52
For example, to open a new tab directly from a button press (no backend involved):
@@ -52,3 +63,43 @@ METHOD z2ui5_if_app~main.
52
63
53
64
ENDMETHOD.
54
65
```
66
+
67
+
## Calling control methods on the frontend
68
+
69
+
The last three constants — `control_by_id`, `control_global` and `binding_call` — are frontend events too, but instead of a fixed built-in action they invoke a *whitelisted* method on a control, a global object or a binding. Their arguments are **positional**: an empty argument between two filled ones keeps its slot as ```` ``.
The same events also work from the backend with `client->follow_up_action( )` using the identical `t_arg`.
85
+
86
+
### The `view` parameter
87
+
88
+
For `control_by_id`, the control is looked up by id. Both `_event_client( )` and `follow_up_action( )` take a separate `view` parameter (default `cs_view-main`) that scopes this lookup:
89
+
90
+
- omit it (or pass `cs_view-main`) — the id is resolved across all open views;
91
+
- pass `cs_view-popup` / `cs_view-popover` / `cs_view-nested` / … — the lookup is scoped to a control hosted in that view (e.g. a control living inside a popup).
92
+
93
+
```abap
94
+
" call a method on a control that lives inside the popup view
The view used to be the second entry of `t_arg` (`id`, `view`, `method`, …). It is now the dedicated `view` importing parameter, so main-view calls simply omit it. Older examples that still pass `` `MAIN` `` as the second `t_arg` element continue to work.
103
+
:::
104
+
105
+
`control_global` and `binding_call` are not resolved by id and ignore `view`.
page->ui_table( rows = client->_bind( val = t_tab2
123
-
view = client->cs_view-nested ) ).
121
+
page->ui_table( rows = client->_bind( t_tab2 ) ).
124
122
" ...columns, toolbar, row actions...
125
123
126
124
client->nest_view_display(
@@ -139,26 +137,24 @@ End-to-end samples:
139
137
-`Z2UI5_CL_DEMO_APP_097` — list master, `sap.ui.table.Table` in the detail with sort/filter/row actions.
140
138
-`Z2UI5_CL_DEMO_APP_085` — full master-detail with an `ObjectPageLayout` as the nested detail, including search, sort, and the FCL fullscreen toggle.
141
139
142
-
#### Routing Bindings to the Right View
140
+
#### Refreshing the Right View
143
141
144
-
Each view (main, nested) has its own client-side model. When you build a binding with `client->_bind( ... )` you can declare which view's model the binding belongs to via the `view` parameter:
145
-
146
-
```abap
147
-
" In the main view
148
-
items = client->_bind( val = t_tab view = client->cs_view-main )
149
-
150
-
" In the nested view
151
-
rows = client->_bind( val = t_tab2 view = client->cs_view-nested )
152
-
```
153
-
154
-
The constants `client->cs_view-main` and `client->cs_view-nested` are abap2UI5's view identifiers. Declaring them lets `nest_view_model_update( )` know which model to refresh:
142
+
All bound data lives in a **single client-side model**, regardless of which view a binding was built in — `client->_bind( ... )` always writes to that one root model. What differs is *which rendered view you refresh* after the ABAP data changes: call the update method that matches the view.
155
143
156
144
```abap
157
145
DELETE t_tab2 WHERE title = ls_arg-title.
158
-
client->nest_view_model_update( ). " only the nested view's data is pushed
146
+
client->nest_view_model_update( ). " push the new data into the nested view
159
147
```
160
148
161
-
If you omit `view`, the binding defaults to the main view, which still works for many cases but is less explicit. Get into the habit of passing the right `cs_view-...` value whenever a fragment is built — it makes the data flow obvious to anyone reading the code.
Earlier releases kept a separate model per view and asked you to tag each binding with `view = client->cs_view-...` so the framework knew which model to refresh. That separation is gone — there is now one root model — and the `view` parameter of `_bind` / `_bind_edit` is an inert no-op kept only for backward compatibility. Omit it, and pick the target view through the matching `..._view_model_update( )` call instead.
Copy file name to clipboardExpand all lines: docs/cookbook/view/xml_templating.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ This timing has two consequences:
19
19
-**Expansion is build-time.** A `template:repeat` over an internal table produces a fixed number of controls; the expanded XML is what UI5 renders.
20
20
-**Data changes do not re-template.** If the data driving the template changes, the existing expansion stays as is. To pick up the change you must rebuild the view (`view_display`) or the templated fragment (`nest_view_display`) — see [Re-rendering](#re-rendering) below.
21
21
22
-
abap2UI5 wires up the templating model for you. Every variable you bind with `client->_bind( ... )`or `client->_bind( ... )`is reachable inside templates via the `template>` model prefix:
22
+
abap2UI5 wires up the templating model for you. Every variable you bind with `client->_bind( ... )` is reachable inside templates via the `template>` model prefix:
0 commit comments