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..e5d1a1d --- /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 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` ). + + l_page->smart_multi_input( + id = 'ProductTypeMultiInput' + value = '{ProductType}' + entityset = 'ProductList' + supportranges = 'true' + enableodataselect = 'true' ). + + m_client->view_display( val = l_page->stringify( ) + 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. + + 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 + + + +