Skip to content

Commit f0fde77

Browse files
authored
fix bind_local
1 parent e30a730 commit f0fde77

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

docs/development/model/model.md

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ outline: [2, 4]
33
---
44
# Model
55

6-
In abap2UI5, there are three ways to exchange data with the frontend.
6+
In abap2UI5, there are two ways to exchange data with the frontend.
77

88
#### One-Way Binding
99
Use one-way binding when you need to display data on the frontend without allowing changes. The `client->_bind` method sends data to the frontend and connects it to the view:
@@ -63,33 +63,6 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
6363
ENDCLASS.
6464
```
6565

66-
#### Local Binding
67-
When you only have local access to data but still want to bind it for display (e.g., for value help or lookups), use local binding. The `client->_bind_local` method copies the data and sends it to the frontend:
68-
69-
```abap
70-
CLASS z2ui5_cl_app_hello_world DEFINITION PUBLIC.
71-
72-
PUBLIC SECTION.
73-
INTERFACES z2ui5_if_app.
74-
75-
ENDCLASS.
76-
77-
CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
78-
METHOD z2ui5_if_app~main.
79-
80-
DATA(lv_name) = 'my local value'.
81-
82-
client->view_display( z2ui5_cl_xml_view=>factory(
83-
)->page( 'abap2UI5 - Hello World'
84-
)->text( `My Text`
85-
)->input( client->_bind_local( lv_name )
86-
)->stringify( ) ).
87-
88-
ENDMETHOD.
89-
ENDCLASS.
90-
```
91-
For an example of local binding in action, refer to the value help use case in `Z2UI5_CL_DEMO_APP_002`.
92-
9366
::: tip **Data in Public Attributes**
9467
When using One-Way or Two-Way binding, ensure your data is stored in the public attributes of your class. This allows the framework to access it from outside. This is similar to the PBO/PAI logic, where data had to be stored in global variables.
9568
:::

docs/development/model/tables.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ Binding nested structures is also possible. Use `structure/component` in the bin
146146
CLASS z2ui5_cl_sample_nested_structures DEFINITION PUBLIC.
147147
PUBLIC SECTION.
148148
INTERFACES z2ui5_if_app.
149-
ENDCLASS.
150-
151-
CLASS z2ui5_cl_sample_nested_structures IMPLEMENTATION.
152-
METHOD z2ui5_if_app~main.
153149
154150
TYPES:
155151
BEGIN OF ty_s_tab,
@@ -161,12 +157,17 @@ CLASS z2ui5_cl_sample_nested_structures IMPLEMENTATION.
161157
END OF ty_s_tab.
162158
DATA mt_itab TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
163159
160+
ENDCLASS.
161+
162+
CLASS z2ui5_cl_sample_nested_structures IMPLEMENTATION.
163+
METHOD z2ui5_if_app~main.
164+
164165
mt_itab = VALUE #(
165166
( product = 'table' s_details = VALUE #( create_date = `01.01.2023` create_by = `Peter` ) )
166167
( product = 'chair' s_details = VALUE #( create_date = `25.10.2022` create_by = `Frank` ) )
167168
( product = 'sofa' s_details = VALUE #( create_date = `12.03.2024` create_by = `George` ) ) ).
168169
169-
DATA(tab) = z2ui5_cl_xml_view=>factory( )->table( client->_bind_local( mt_itab ) ).
170+
DATA(tab) = z2ui5_cl_xml_view=>factory( )->table( client->_bind( mt_itab ) ).
170171
171172
DATA(lo_columns) = tab->columns( ).
172173
lo_columns->column( )->text( text = `Product` ).

docs/technical/dx.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,19 @@ abap2UI5 follows a similar pattern. Just bind the internal table to a UI5 table
113113
CLASS zcl_app_alv DEFINITION PUBLIC.
114114
PUBLIC SECTION.
115115
INTERFACES z2ui5_if_app.
116+
DATA gt_t100 TYPE STANDARD TABLE OF t100 WITH EMPTY KEY.
116117
ENDCLASS.
117118
118119
CLASS zcl_app_alv IMPLEMENTATION.
119120
METHOD z2ui5_if_app~main.
120121
121122
SELECT FROM t100
122123
FIELDS *
123-
INTO TABLE @DATA(gt_t100)
124+
INTO TABLE @gt_t100
124125
UP TO 10 ROWS.
125126
126127
DATA(tab) = z2ui5_cl_xml_view=>factory(
127-
)->table( client->_bind_local( gt_t100 ) ).
128+
)->table( client->_bind( gt_t100 ) ).
128129
129130
DATA(lo_col) = tab->columns( ).
130131
lo_col->column( )->text( `ARBGB` ).

0 commit comments

Comments
 (0)