Skip to content

Commit

Permalink
Update z2ui5_cl_demo_app_176.clas.abap (#128)
Browse files Browse the repository at this point in the history
* Update z2ui5_cl_demo_app_173.clas.abap

Update Templating

* Example Nested View with Templating

* Update z2ui5_cl_demo_app_176.class.xml

* Update

* Update z2ui5_cl_demo_app_176.clas.abap

* Update z2ui5_cl_demo_app_176.clas.abap

---------

Co-authored-by: oblomov <[email protected]>
  • Loading branch information
abapsheep and oblomov-dev authored Feb 26, 2024
1 parent 74ef357 commit 9052ee4
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
100 changes: 100 additions & 0 deletions src/z2ui5_cl_demo_app_176.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
CLASS z2ui5_cl_demo_app_176 DEFINITION PUBLIC.

PUBLIC SECTION.

INTERFACES Z2UI5_if_app.

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.

TYPES:
BEGIN OF ty_s_layout,
FNAME type string,
merge TYPE string,
visible TYPE string,
binding 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.

METHODS main_view
IMPORTING
i_client TYPE REF TO z2ui5_if_client.
METHODS nest_view
IMPORTING
i_client TYPE REF TO z2ui5_if_client.

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_demo_app_176 IMPLEMENTATION.

METHOD z2ui5_if_app~main.

main_view( client ).

nest_view( client ).

ENDMETHOD.

METHOD nest_view.

i_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' binding = '{NAME}' )
( fname = 'DATE' merge = 'false' visible = 'true' binding = '{DATE}' )
( fname = 'AGE' merge = 'false' visible = 'false' binding = '{AGE}' ) ).

DATA(lo_view_nested) = z2ui5_cl_xml_view=>factory( ).

lo_view_nested->shell( )->page(
)->table( items = i_client->_bind( mt_data )
)->columns(
)->template_repeat( list = `{meta>/MT_LAYOUT}` var = `LO`
)->column( mergeduplicates = `{LO>MERGE}` visible = `{LO>VISIBLE}` )->get_parent(
)->get_parent( )->get_parent(
)->items(
)->column_list_item(
)->cells(
)->template_repeat( list = `{meta>/MT_LAYOUT}` var = `LO2`
)->object_identifier( text = `{LO2>BINDING}` ).


i_client->nest_view_display( val = lo_view_nested->stringify( ) id = `test` method_insert = 'addContent' ).

ENDMETHOD.

METHOD main_view.

DATA(lo_view) = z2ui5_cl_xml_view=>factory( ).

DATA(page) = lo_view->shell(
)->page(
title = `Main View`
id = `test`
navbuttonpress = i_client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
text = 'Source_Code'
target = '_blank'
href = z2ui5_cl_demo_utility=>factory( i_client )->app_get_url_source_code( )
)->get_parent( ).

i_client->view_display( lo_view->stringify( ) ).

ENDMETHOD.

ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_176.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_176</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Templating in Nested View</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 9052ee4

Please sign in to comment.