Skip to content

Commit

Permalink
add expand/collapse-all buttons (#418)
Browse files Browse the repository at this point in the history
make browser search (CTRL+F) easier
  • Loading branch information
christianguenter2 authored Nov 14, 2024
1 parent 842fe2c commit ac0c7df
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/z2ui5_cl_demo_app_000.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

PROTECTED SECTION.
PRIVATE SECTION.
METHODS expand_all.

ENDCLASS.

Expand All @@ -49,6 +50,10 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
WHEN 'BACK'.
client->nav_app_leave( ).

WHEN 'expand-all'.
expand_all( ).
WHEN 'collapse-all'.
CLEAR: ms_check_expanded.
WHEN OTHERS.
TRY.
DATA(lv_classname) = to_upper( client->get( )-event ).
Expand Down Expand Up @@ -90,6 +95,10 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
`<p>Always press CTRL+F12 to see code samples and classname of the app.</p>`
).

page->hbox(
)->button( press = client->_event( 'expand-all' ) icon = 'sap-icon://expand-all'
)->button( press = client->_event( 'collapse-all' ) icon = 'sap-icon://collapse-all' ).

DATA(page2) = page.

page = page->panel(
Expand Down Expand Up @@ -2149,4 +2158,18 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
client->view_display( page->stringify( ) ).

ENDMETHOD.
ENDCLASS.


METHOD expand_all.

DO.
ASSIGN COMPONENT sy-index OF STRUCTURE ms_check_expanded TO FIELD-SYMBOL(<check>).
IF sy-subrc <> 0.
EXIT.
ENDIF.
<check> = abap_true.
ENDDO.

ENDMETHOD.

ENDCLASS.

0 comments on commit ac0c7df

Please sign in to comment.