Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Demo for SmartMultiInput feature #463

Merged
merged 3 commits into from
Dec 10, 2024
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
94 changes: 94 additions & 0 deletions src/z2ui5_cl_demo_app_319.clas.abap
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_319.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_319</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>odata, smartmultiinput</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>
Loading