mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 15:16:15 +08:00
parent
976658b611
commit
4e79716a55
|
@ -36,24 +36,24 @@ CLASS z2ui5_cl_app_demo_48 IMPLEMENTATION.
|
|||
check_initialized = abap_true.
|
||||
|
||||
t_tab = VALUE #(
|
||||
( title = 'Peter' info = 'Information' descr = 'this is a description1 1234567890 1234567890' icon = 'sap-icon://badge' highlight = 'Information' wrapCharLimit = '100' )
|
||||
( title = 'Peter1' info = 'Success' descr = 'this is a description2 1234567890 1234567890' icon = 'sap-icon://favorite' highlight = 'Success' wrapCharLimit = '10')
|
||||
( title = 'Peter2' info = 'Warning' descr = 'this is a description3 1234567890 1234567890' icon = 'sap-icon://employee' highlight = 'Warning' wrapCharLimit = '100')
|
||||
( title = 'Peter3' info = 'Error' descr = 'this is a description4 1234567890 1234567890' icon = 'sap-icon://accept' highlight = 'Error' wrapCharLimit = '10' )
|
||||
( title = 'Peter4' info = 'None' descr = 'this is a description5 1234567890 1234567890' icon = 'sap-icon://activities' highlight = 'None' wrapCharLimit = '10')
|
||||
( title = 'Peter5' info = 'Information' descr = 'this is a description6 1234567890 1234567890' icon = 'sap-icon://account' highlight = 'Information' wrapCharLimit = '100' )
|
||||
( title = 'entry_01' info = 'Information' descr = 'this is a description1 1234567890 1234567890' icon = 'sap-icon://badge' highlight = 'Information' wrapCharLimit = '100' )
|
||||
( title = 'entry_02' info = 'Success' descr = 'this is a description2 1234567890 1234567890' icon = 'sap-icon://favorite' highlight = 'Success' wrapCharLimit = '10')
|
||||
( title = 'entry_03' info = 'Warning' descr = 'this is a description3 1234567890 1234567890' icon = 'sap-icon://employee' highlight = 'Warning' wrapCharLimit = '100')
|
||||
( title = 'entry_04' info = 'Error' descr = 'this is a description4 1234567890 1234567890' icon = 'sap-icon://accept' highlight = 'Error' wrapCharLimit = '10' )
|
||||
( title = 'entry_05' info = 'None' descr = 'this is a description5 1234567890 1234567890' icon = 'sap-icon://activities' highlight = 'None' wrapCharLimit = '10')
|
||||
( title = 'entry_06' info = 'Information' descr = 'this is a description6 1234567890 1234567890' icon = 'sap-icon://account' highlight = 'Information' wrapCharLimit = '100' )
|
||||
).
|
||||
|
||||
ENDIF.
|
||||
|
||||
CASE client->get( )-event.
|
||||
WHEN 'TEST'.
|
||||
WHEN 'EDIT'.
|
||||
data(lv_row_title) = client->get( )-event_data.
|
||||
client->popup_message_box( `event: test - ` && lv_row_title ).
|
||||
client->popup_message_box( `EDIT - ` && lv_row_title ).
|
||||
WHEN 'SELCHANGE'.
|
||||
DATA(lt_sel) = t_tab.
|
||||
DELETE lt_sel WHERE selected = abap_false.
|
||||
client->popup_message_box( `event: selection change -` && lt_sel[ 1 ]-title ).
|
||||
client->popup_message_box( `SELECTION_CHANGED -` && lt_sel[ 1 ]-title ).
|
||||
WHEN 'BACK'.
|
||||
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
|
||||
ENDCASE.
|
||||
|
@ -89,7 +89,7 @@ CLASS z2ui5_cl_app_demo_48 IMPLEMENTATION.
|
|||
( n = 'wrapping' v = `true` )
|
||||
( n = 'wrapCharLimit' v = `{WRAPCHARLIMIT}` )
|
||||
( n = 'selected' v = `{SELECTED}` )
|
||||
( n = 'detailPress' v = client->_event( val = 'TEST' data = `${TITLE}` ) )
|
||||
( n = 'detailPress' v = client->_event( val = 'EDIT' data = `${TITLE}` ) )
|
||||
|
||||
) ).
|
||||
client->set_next( VALUE #( xml_main = page->get_root( )->xml_get( ) ) ).
|
||||
|
|
|
@ -31,7 +31,7 @@ CLASS z2ui5_cl_app_demo_49 DEFINITION PUBLIC.
|
|||
headerpinned TYPE abap_bool,
|
||||
headerexpanded TYPE abap_bool,
|
||||
search_val TYPE string,
|
||||
title type string,
|
||||
title TYPE string,
|
||||
t_tab TYPE STANDARD TABLE OF ty_S_out WITH EMPTY KEY,
|
||||
END OF ms_view.
|
||||
|
||||
|
@ -87,7 +87,7 @@ CLASS z2ui5_cl_app_demo_49 DEFINITION PUBLIC.
|
|||
|
||||
TYPES:
|
||||
BEGIN OF ty_S_db_layout,
|
||||
SELKZ TYPE ABap_bool,
|
||||
selkz TYPE ABap_bool,
|
||||
name TYPE string,
|
||||
user TYPE string,
|
||||
default TYPE abap_bool,
|
||||
|
@ -124,6 +124,7 @@ CLASS z2ui5_cl_app_demo_49 DEFINITION PUBLIC.
|
|||
i_view TYPE REF TO z2ui5_cl_xml_view.
|
||||
METHODS z2ui5_set_search.
|
||||
METHODS z2ui5_set_detail.
|
||||
METHODS z2ui5_set_sort.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -160,6 +161,14 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
|
||||
CASE app-get-event.
|
||||
|
||||
WHEN 'SORT_ADD'.
|
||||
INSERT VALUE #( ) INTO TABLE ms_layout-t_sort.
|
||||
app-view_popup = 'POPUP_SETUP'.
|
||||
|
||||
WHEN `SORT_DELETE`.
|
||||
DELETE ms_layout-t_sort WHERE name = app-get-event_data.
|
||||
app-view_popup = 'POPUP_SETUP'.
|
||||
|
||||
WHEN 'BUTTON_DELETE'.
|
||||
DELETE ms_view-t_tab WHERE selkz = abap_true.
|
||||
|
||||
|
@ -178,7 +187,7 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
mv_check_download_csv = abap_true.
|
||||
|
||||
WHEN `POPUP_LAYOUT_LOAD`.
|
||||
data(ls_layout2) = mt_db_layout[ selkz = abap_true ].
|
||||
DATA(ls_layout2) = mt_db_layout[ selkz = abap_true ].
|
||||
z2ui5_lcl_utility=>trans_xml_2_object(
|
||||
EXPORTING
|
||||
xml = ls_layout2-data
|
||||
|
@ -232,7 +241,6 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
|
||||
ENDCASE.
|
||||
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -296,11 +304,11 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
title = lr_col->*
|
||||
) INTO TABLE ms_layout-t_cols.
|
||||
|
||||
INSERT VALUE #(
|
||||
" selkz = abap_true
|
||||
name = lr_col->*
|
||||
" length = `10px`
|
||||
) INTO TABLE ms_layout-t_cols.
|
||||
* INSERT VALUE #(
|
||||
* " selkz = abap_true
|
||||
* name = lr_col->*
|
||||
* " length = `10px`
|
||||
* ) INTO TABLE ms_layout-t_cols.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
|
@ -309,6 +317,8 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
|
||||
METHOD z2ui5_on_render_main.
|
||||
|
||||
z2ui5_set_sort( ).
|
||||
|
||||
" DATA(view) = z2ui5_cl_xml_view=>factory( )->shell( ).
|
||||
|
||||
DATA(view) = z2ui5_cl_xml_view=>factory(
|
||||
|
@ -575,12 +585,14 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
" )->text( '{DESCR}'
|
||||
)->get_parent( )->get_parent( )->get_parent( )->get_parent( )->get_parent( ).
|
||||
|
||||
DATA(lo_hbox) = lo_tab->tab(
|
||||
DATA(lo_tab_sort) = lo_tab->tab(
|
||||
text = 'Sort'
|
||||
selected = client->_bind( mv_check_sort )
|
||||
selected = client->_bind( mv_check_sort ) ).
|
||||
|
||||
)->list(
|
||||
items = client->_bind( ms_layout-t_cols )
|
||||
lo_tab_sort->button( icon = `sap-icon://add` press = client->_event( `SORT_ADD` ) ).
|
||||
|
||||
DATA(lo_hbox) = lo_tab_sort->list(
|
||||
items = client->_bind( ms_layout-t_sort )
|
||||
selectionchange = client->_event( 'SELCHANGE' )
|
||||
)->custom_list_item(
|
||||
)->hbox( ).
|
||||
|
@ -605,8 +617,7 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
key = 'ASCENDING'
|
||||
icon = 'sap-icon://sort-ascending'
|
||||
)->get_parent( )->get_parent(
|
||||
)->text( text = `{TYPE}`
|
||||
)->button( text = 'close' ).
|
||||
)->button( type = `Transparent` icon = 'sap-icon://decline' press = client->_event( val = `SORT_DELETE` data = `${NAME}` ) ).
|
||||
* )->get_parent( )->get_parent( )->get_parent(
|
||||
|
||||
* )->button(
|
||||
|
@ -807,4 +818,27 @@ CLASS z2ui5_cl_app_demo_49 IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_set_sort.
|
||||
|
||||
"quick and dirty, only works for 4 conditions
|
||||
TRY.
|
||||
IF ms_layout-t_sort IS NOT INITIAL.
|
||||
DATA(ls_field1) = VALUE #( ms_layout-t_sort[ 1 ] OPTIONAL ).
|
||||
DATA(ls_field2) = VALUE #( ms_layout-t_sort[ 2 ] OPTIONAL ).
|
||||
DATA(ls_field3) = VALUE #( ms_layout-t_sort[ 3 ] OPTIONAL ).
|
||||
DATA(ls_field4) = VALUE #( ms_layout-t_sort[ 4 ] OPTIONAL ).
|
||||
|
||||
SORT ms_view-t_tab BY
|
||||
(ls_field1-name) (ls_field1-type)
|
||||
(ls_field2-name) (ls_field2-type)
|
||||
(ls_field3-name) (ls_field3-type)
|
||||
(ls_field4-name) (ls_field4-type).
|
||||
|
||||
ENDIF.
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
Loading…
Reference in New Issue
Block a user