From cad9c3b9b2c14371ef21959bf0513f27a411d8f5 Mon Sep 17 00:00:00 2001 From: mzinnoecker <29286643+mzinnoecker@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:52:00 +0000 Subject: [PATCH 1/2] SmartMultiInput Demo --- src/z2ui5_cl_demo_app_319.clas.abap | 94 +++++++++++++++++++++++++++++ src/z2ui5_cl_demo_app_319.clas.xml | 16 +++++ 2 files changed, 110 insertions(+) create mode 100644 src/z2ui5_cl_demo_app_319.clas.abap create mode 100644 src/z2ui5_cl_demo_app_319.clas.xml diff --git a/src/z2ui5_cl_demo_app_319.clas.abap b/src/z2ui5_cl_demo_app_319.clas.abap new file mode 100644 index 0000000..e048fe6 --- /dev/null +++ b/src/z2ui5_cl_demo_app_319.clas.abap @@ -0,0 +1,94 @@ +CLASS z2ui5_cl_demo_app_319 DEFINITION PUBLIC. + + PUBLIC SECTION. + INTERFACES z2ui5_if_app. + + TYPES: + BEGIN OF t_token, + key TYPE string, + text TYPE string, + END OF t_token, + t_tokens TYPE STANDARD TABLE OF t_token WITH EMPTY KEY. + TYPES: + BEGIN OF t_range, + exclude TYPE boole_d, + operation TYPE string, + value1 TYPE string, + value2 TYPE string, + keyField TYPE string, + END OF t_range, + t_ranges TYPE STANDARD TABLE OF t_range WITH EMPTY KEY. + DATA: + BEGIN OF m_selection, + BEGIN OF product_type, + tokens_added TYPE t_tokens, + tokens_removed TYPE t_tokens, + ranges TYPE t_ranges, + END OF product_type, + END OF m_selection. + PROTECTED SECTION. + DATA m_client TYPE REF TO z2ui5_if_client. + METHODS on_init. + METHODS on_event. +ENDCLASS. + +CLASS z2ui5_cl_demo_app_319 IMPLEMENTATION. + + METHOD z2ui5_if_app~main. + + m_client = client. + + IF m_client->check_on_init( ). + on_init( ). + RETURN. + ENDIF. + + on_event( ). + + ENDMETHOD. + + METHOD on_init. + + DATA(l_view) = z2ui5_cl_xml_view=>factory( ). + + DATA(l_page) = l_view->shell( appwidthlimited = 'false' )->page( + id = 'SearchPage' + title = TEXT-001 + shownavbutton = abap_false + showheader = abap_true ). + + l_page->_z2ui5( )->smartmultiinput_ext( + addedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_added switchdefaultmodel = abap_true ) + removedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_removed switchdefaultmodel = abap_true ) + rangeData = m_client->_bind_edit( val = m_selection-product_type-ranges switchdefaultmodel = abap_true ) + change = m_client->_event( 'PRODTYPE_CHANGED' ) + multiinputid = `ProductTypeMultiInput` ). + + l_page->smart_multi_input( + id = 'ProductTypeMultiInput' + value = '{ProductType}' + entityset = 'ProductList' + supportranges = 'true' + enableodataselect = 'true' ). + + m_client->view_display( val = l_page->stringify( ) + switchdefaultmodel = `/sap/opu/odata/sap/UI_PRODUCTLIST` + switchdefaultmodelannouri = `/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='UI_PRODUCTLIST_VAN',Version='0001')/$value` ). + + ENDMETHOD. + + METHOD on_event. + + CASE m_client->get( )-event. + WHEN 'PRODTYPE_CHANGED'. + TRY. + m_client->message_box_display( + text = z2ui5_cl_ajson=>new( )->set( iv_path = '/' iv_val = m_selection-product_type-ranges )->stringify( ) + title = 'range content' ). + CATCH z2ui5_cx_ajson_error INTO DATA(lx_ajson). + m_client->message_toast_display( lx_ajson->get_text( ) ). + ENDTRY. + ENDCASE. + + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_319.clas.xml b/src/z2ui5_cl_demo_app_319.clas.xml new file mode 100644 index 0000000..a2fe5bb --- /dev/null +++ b/src/z2ui5_cl_demo_app_319.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_319 + E + odata, smartmultiinput + 1 + X + X + X + + + + From 614abe9772ac64dd850a08d4a5192c0944788a4f Mon Sep 17 00:00:00 2001 From: oblomov-dev <102328295+oblomov-dev@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:33:19 +0100 Subject: [PATCH 2/2] Update z2ui5_cl_demo_app_319.clas.abap --- src/z2ui5_cl_demo_app_319.clas.abap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/z2ui5_cl_demo_app_319.clas.abap b/src/z2ui5_cl_demo_app_319.clas.abap index e048fe6..e5d1a1d 100644 --- a/src/z2ui5_cl_demo_app_319.clas.abap +++ b/src/z2ui5_cl_demo_app_319.clas.abap @@ -58,9 +58,9 @@ CLASS z2ui5_cl_demo_app_319 IMPLEMENTATION. showheader = abap_true ). l_page->_z2ui5( )->smartmultiinput_ext( - addedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_added switchdefaultmodel = abap_true ) - removedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_removed switchdefaultmodel = abap_true ) - rangeData = m_client->_bind_edit( val = m_selection-product_type-ranges switchdefaultmodel = abap_true ) + addedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_added switch_default_model = abap_true ) + removedtokens = m_client->_bind_edit( val = m_selection-product_type-tokens_removed switch_default_model = abap_true ) + rangeData = m_client->_bind_edit( val = m_selection-product_type-ranges switch_default_model = abap_true ) change = m_client->_event( 'PRODTYPE_CHANGED' ) multiinputid = `ProductTypeMultiInput` ). @@ -72,7 +72,7 @@ CLASS z2ui5_cl_demo_app_319 IMPLEMENTATION. enableodataselect = 'true' ). m_client->view_display( val = l_page->stringify( ) - switchdefaultmodel = `/sap/opu/odata/sap/UI_PRODUCTLIST` + switch_default_model_path = `/sap/opu/odata/sap/UI_PRODUCTLIST` switchdefaultmodelannouri = `/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='UI_PRODUCTLIST_VAN',Version='0001')/$value` ). ENDMETHOD.