Skip to content

Commit 3305db9

Browse files
New Sample: Search Field (#397)
1 parent 02e30b3 commit 3305db9

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,13 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
811811
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
812812
).
813813

814+
panel->generic_tile(
815+
header = 'Search Field'
816+
press = client->_event( 'Z2UI5_CL_DEMO_APP_296' )
817+
mode = 'LineMode'
818+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
819+
).
820+
814821
panel = page->panel(
815822
expandable = abap_false
816823
expanded = abap_true

src/z2ui5_cl_demo_app_296.clas.abap

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
CLASS z2ui5_cl_demo_app_296 DEFINITION
2+
PUBLIC
3+
CREATE PUBLIC.
4+
5+
PUBLIC SECTION.
6+
7+
INTERFACES z2ui5_if_app.
8+
9+
DATA check_initialized TYPE abap_bool.
10+
11+
PROTECTED SECTION.
12+
13+
DATA client TYPE REF TO z2ui5_if_client.
14+
15+
METHODS display_view
16+
IMPORTING
17+
client TYPE REF TO z2ui5_if_client.
18+
METHODS on_event
19+
IMPORTING
20+
client TYPE REF TO z2ui5_if_client.
21+
METHODS z2ui5_display_popover
22+
IMPORTING
23+
id TYPE string.
24+
25+
PRIVATE SECTION.
26+
ENDCLASS.
27+
28+
29+
30+
CLASS z2ui5_cl_demo_app_296 IMPLEMENTATION.
31+
32+
33+
METHOD display_view.
34+
35+
DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell(
36+
)->page(
37+
title = `abap2UI5 - Sample: Search Field`
38+
navbuttonpress = client->_event( 'BACK' )
39+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
40+
41+
page_01->header_content(
42+
)->button( id = `button_hint_id`
43+
icon = `sap-icon://hint`
44+
tooltip = `Sample information`
45+
press = client->_event( 'CLICK_HINT_ICON' ) ).
46+
47+
page_01->header_content(
48+
)->link(
49+
text = 'UI5 Demo Kit'
50+
target = '_blank'
51+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.SearchField/sample/sap.m.sample.SearchField' ).
52+
53+
page_01->page( showheader = abap_false
54+
)->sub_header(
55+
)->toolbar(
56+
)->search_field( width = `100%` search = client->_event( val = `onSearch` )
57+
)->text( text = `Default Search` id = `idSearchListToolbar`
58+
)->get_parent(
59+
)->get_parent(
60+
)->vbox( class = `sapUiSmallMargin`
61+
)->label( text = `Default Search Field:`
62+
)->search_field( width = `90%` class = `sapUiSmallMargin`
63+
)->get_parent(
64+
).
65+
66+
client->view_display( page_01->stringify( ) ).
67+
68+
ENDMETHOD.
69+
70+
71+
METHOD on_event.
72+
73+
CASE client->get( )-event.
74+
WHEN 'BACK'.
75+
client->nav_app_leave( ).
76+
WHEN 'CLICK_HINT_ICON'.
77+
z2ui5_display_popover( `button_hint_id` ).
78+
WHEN 'onSearch'.
79+
client->message_toast_display( `'search' event fired with 'searchButtonPressed' parameter` ).
80+
ENDCASE.
81+
82+
ENDMETHOD.
83+
84+
85+
METHOD z2ui5_display_popover.
86+
87+
DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
88+
view->quick_view( placement = `Bottom` width = `auto`
89+
)->quick_view_page( pageid = `sampleInformationId`
90+
header = `Sample information`
91+
description = `Use the Search Field to let the user enter a search string and trigger the search process.` ).
92+
93+
client->popover_display(
94+
xml = view->stringify( )
95+
by_id = id
96+
).
97+
98+
ENDMETHOD.
99+
100+
101+
METHOD z2ui5_if_app~main.
102+
103+
me->client = client.
104+
105+
IF check_initialized = abap_false.
106+
check_initialized = abap_true.
107+
display_view( client ).
108+
ENDIF.
109+
110+
on_event( client ).
111+
112+
ENDMETHOD.
113+
ENDCLASS.

src/z2ui5_cl_demo_app_296.clas.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>Z2UI5_CL_DEMO_APP_296</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Search Field</DESCRIPT>
9+
<STATE>1</STATE>
10+
<CLSCCINCL>X</CLSCCINCL>
11+
<FIXPT>X</FIXPT>
12+
<UNICODE>X</UNICODE>
13+
</VSEOCLASS>
14+
</asx:values>
15+
</asx:abap>
16+
</abapGit>

0 commit comments

Comments
 (0)