Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/z2ui5_cl_demo_app_116.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ENDCLASS.



CLASS z2ui5_cl_demo_app_116 IMPLEMENTATION.
CLASS Z2UI5_CL_DEMO_APP_116 IMPLEMENTATION.


METHOD add_node.
Expand Down Expand Up @@ -87,7 +87,7 @@ CLASS z2ui5_cl_demo_app_116 IMPLEMENTATION.


DATA(view) = z2ui5_cl_xml_view=>factory( ).
view->_z2ui5( )->timer( checkactive = client->_bind_edit( mv_run_js ) finished = `setState();` ).
* view->_z2ui5( )->timer( checkactive = client->_bind_edit( mv_run_js ) finished = `setState();` ).

* DATA(page) = view->shell(
* )->page()
Expand Down Expand Up @@ -220,9 +220,9 @@ CLASS z2ui5_cl_demo_app_116 IMPLEMENTATION.
` if( sap.z2ui5.treeState == undefined ) {` && |\n| &&
` sap.z2ui5.treeState = treeTable.getBinding('rows').getCurrentTreeState();` && |\n| &&
` } else {` && |\n| &&
` treeTable.getBinding('rows').getCurrentTreeState();` && |\n| &&
` treeTable.getBinding("rows").refresh();` && |\n| &&
` treeTable.getBinding("rows").setTreeState(sap.z2ui5.treeState);` && |\n| &&
` treeTable.getBinding("rows").refresh();` && |\n| &&
` sap.z2ui5.treeState = treeTable.getBinding('rows').getCurrentTreeState();` && |\n| &&
` };` && |\n| &&
`};`.

Expand Down Expand Up @@ -256,6 +256,8 @@ CLASS z2ui5_cl_demo_app_116 IMPLEMENTATION.

client->view_model_update( ).

client->follow_up_action( custom_js = `setState();` ).

ENDCASE.

ENDMETHOD.
Expand Down
75 changes: 57 additions & 18 deletions src/z2ui5_cl_demo_app_173.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ CLASS z2ui5_cl_demo_app_173 DEFINITION
END OF ty_s_layout,
ty_t_layout TYPE STANDARD TABLE OF ty_s_layout WITH EMPTY KEY.

DATA mv_flag TYPE abap_bool. " VALUE abap_true.
DATA mv_initialized TYPE abap_bool.

DATA mt_layout TYPE ty_t_layout.
DATA mt_data TYPE ty_t_data.

METHODS view_display.

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.

PRIVATE SECTION.
ENDCLASS.

Expand All @@ -34,26 +42,10 @@ ENDCLASS.
CLASS Z2UI5_CL_DEMO_APP_173 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
RETURN.
ENDCASE.

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' ) ).

METHOD view_display.
DATA(view) = z2ui5_cl_xml_view=>factory( ).

view = view->shell( )->page( id = `page_main`
view = view->shell( )->page( id = `page_main` class = `sapUiContentPadding`
title = 'abap2UI5 - Sample Templating I'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
Expand All @@ -70,7 +62,54 @@ CLASS Z2UI5_CL_DEMO_APP_173 IMPLEMENTATION.
)->template_repeat( list = `{template>/MT_LAYOUT}` var = `L1`
)->object_identifier( text = `{= '{' + ${L1>FNAME} + '}' }` ).


view->label( text = `IF Template (with re-rendering)` ).
view->switch( state = client->_bind_edit( mv_flag ) change = client->_event( `CHANGE_FLAG` ) ).
view = view->vbox( ).

view->template_if( test = `{template>/XX/MV_FLAG}`
)->template_then(
)->icon( src = `sap-icon://accept` color = `green` )->get_parent(
)->template_else(
)->icon( src = `sap-icon://decline` color = `red`
).


client->view_display( view->stringify( ) ).
ENDMETHOD.


METHOD z2ui5_if_app~main.

me->client = client.

IF mv_initialized = abap_false.
mv_initialized = abap_true.

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' ) ).


view_display( ).

ENDIF.

CASE client->get( )-event.
WHEN 'CHANGE_FLAG'.

view_display( ).

WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
RETURN.
ENDCASE.


ENDMETHOD.
ENDCLASS.