Samples / Controls / sap.m

Date Time Picker - Open by Another Control

This example shows Date Time Picker which is opened by another control.

Class
z2ui5_cl_smpc_app_257
Repository
abap2UI5/samples-controls
Ports
sap.m.sample.DateTimePickerHidden
UI5 libraries
sap.m, sap.ui.core
Lowest UI5 release
1.97
In the browser
Runs in the playground
Controls it builds
sap.m.Button, sap.m.DateTimePicker, sap.m.Label, sap.m.Link, sap.m.Title, sap.m.VBox, sap.ui.core.mvc.View

The class

" @keywords datetimepicker date time picker sap.m datetimepickerhidden title vbox label button link
" @summary This example shows Date Time Picker which is opened by another control.
" @origin sap.m.sample.DateTimePickerHidden - https://sdk.openui5.org/entity/sap.m.DateTimePicker/sample/sap.m.sample.DateTimePickerHidden (status: checked - verified in a running system)
CLASS z2ui5_cl_smpc_app_257 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_257 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_navigated( ).
      view_display( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

    DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).

    view->ele( n = `View` ns = `mvc`
        )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
        )->a( n = `xmlns`     v = `sap.m`

        )->tag( `Title`
            )->a( n = `class` v = `sapUiSmallMargin`
            )->a( n = `text`  v = `Open Date Time Picker by Another Control`

        )->ele( `VBox`
            )->a( n = `class` v = `sapUiSmallMargin`

            )->tag( `Label`
                )->a( n = `text` v = `By Button with text`
            )->tag( `Button`
                )->a( n = `ariaHasPopup` v = `Dialog`
                )->a( n = `text`         v = `Open Date Time Picker`
                )->a( n = `press`        v = client->follow_up_action( val = client->cs_event-control_by_id t_arg = VALUE #( ( `HiddenDTP` ) ( `openBy` ) ( `$event.oSource.sId` ) ) )

        )->end(
        )->ele( `VBox`
            )->a( n = `class` v = `sapUiSmallMargin`

            )->tag( `Label`
                )->a( n = `text` v = `By Button with icon`
            )->tag( `Button`
                )->a( n = `ariaHasPopup` v = `Dialog`
                )->a( n = `tooltip`      v = `Open Date Time Picker`
                )->a( n = `icon`         v = `sap-icon://appointment-2`
                )->a( n = `press`        v = client->follow_up_action( val = client->cs_event-control_by_id t_arg = VALUE #( ( `HiddenDTP` ) ( `openBy` ) ( `$event.oSource.sId` ) ) )

        )->end(
        )->ele( `VBox`
            )->a( n = `class` v = `sapUiSmallMargin`

            )->tag( `Label`
                )->a( n = `text` v = `By Link`
            )->tag( `Link`
                )->a( n = `ariaHasPopup` v = `Dialog`
                )->a( n = `text`         v = `Open Date Time Picker`
                )->a( n = `press`        v = client->follow_up_action( val = client->cs_event-control_by_id t_arg = VALUE #( ( `HiddenDTP` ) ( `openBy` ) ( `$event.oSource.sId` ) ) )

        )->end(
        )->tag( `DateTimePicker`
            )->a( n = `id`        v = `HiddenDTP`
            )->a( n = `hideInput` v = `true`
            )->a( n = `change`    v = client->follow_up_action( val = client->cs_event-control_global t_arg = VALUE #( ( `MESSAGE_TOAST` ) ( `show` ) ( `Date and Time selected: {0}` ) ( `${$parameters>/value}` ) ) ) ).

    client->view_display( view->stringify( ) ).

  ENDMETHOD.

ENDCLASS.