Skip to content

Commit

Permalink
Update z2ui5_cl_demo_app_173.clas.abap (#124)
Browse files Browse the repository at this point in the history
Updated Templating Example
  • Loading branch information
abapsheep authored Feb 23, 2024
1 parent 2e8c1c8 commit ff30743
Showing 1 changed file with 45 additions and 21 deletions.
66 changes: 45 additions & 21 deletions src/z2ui5_cl_demo_app_173.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,65 @@ CLASS z2ui5_cl_demo_app_173 DEFINITION
TYPES:
BEGIN OF ty_s_data,
name TYPE string,
DATE type string,
AGE type string,
END OF ty_s_data,
ty_t_data TYPE STANDARD TABLE OF ty_s_data WITH EMPTY KEY.

DATA mt_data TYPE ty_t_data.
TYPES:
BEGIN OF ty_s_layout,
FNAME type string,
merge TYPE string,
visible TYPE string,
END OF ty_s_layout,
ty_t_layout TYPE STANDARD TABLE OF ty_s_layout WITH EMPTY KEY.

DATA mt_layout TYPE ty_t_layout.
DATA mt_data TYPE ty_t_data.

PROTECTED SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.



CLASS z2ui5_cl_demo_app_173 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

client->_bind( mt_data ).
mt_data = VALUE #( ( name = 'Theo')
( name = 'Lore' ) ).
client->_bind( mt_layout ).

mt_data = VALUE #( ( name = 'Theo' date = '01.01.2000' age = '5' )
( name = 'Lore' date = '01.01.2000' age = '1' ) ).

mt_layout = VALUE #( ( fname = 'NAME' merge = 'false' visible = 'true' )
( fname = 'DATE' merge = 'false' visible = 'true' )
( fname = 'AGE' merge = 'false' visible = 'false' ) ).

DATA(xml) =
'<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1">' &&
' <App> ' &&
' <Page title="XML Templating"> ' &&
' <OverflowToolbar> ' &&
' <ToolbarSpacer /> ' &&
' <template:repeat list="{meta>/MT_DATA}" var="MT_DATA"> ' &&
' <ToggleButton text="{MT_DATA>NAME}" /> ' &&
' </template:repeat> ' &&
' <ToolbarSpacer /> ' &&
' <OverflowToolbarButton icon="sap-icon://action-settings" /> ' &&
' </OverflowToolbar> ' &&
' </Page> ' &&
' </App> ' &&
'</mvc:View>'.
`<mvc:View xmlns="sap.m " xmlns:core="sap.ui.core " xmlns:mvc="sap.ui.core.mvc " displayBlock="true " height="100% ">` &&
` <Shell>` &&
` <Page>` &&
` <Table items="{/MT_DATA}">` &&
` <columns>` &&
` <template:repeat list="{meta>/MT_LAYOUT} " var="MT_LAYOUT">` &&
` <Column` &&
` mergeDuplicates="{MT_LAYOUT>MERGE}"` &&
` visible="{MT_LAYOUT>VISIBLE}"/>` &&
` </template:repeat>` &&
` </columns>` &&
` <items>` &&
` <ColumnListItem>` &&
` <cells>` &&
` <template:repeat list="{meta>/MT_LAYOUT}" var="MT_LAYOUT">` &&
` <ObjectIdentifier text="{MT_LAYOUT>FNAME}"/>` &&
` </template:repeat>` &&
` </cells>` &&
` </ColumnListItem>` &&
` </items>` &&
` </Table>` &&
` </Page>` &&
` </Shell>` &&
`</mvc:View> `.

client->view_display( xml ).

Expand Down

0 comments on commit ff30743

Please sign in to comment.