abap2UI5 / abap2UI5

Developing UI5 Apps Purely in ABAP
http://www.abap2UI5.org
MIT License
295 stars 57 forks source link

UI Element Color Picker #1322

Closed Marchl-Woid closed 2 months ago

Marchl-Woid commented 2 months ago

Hello together maybe someone has an hint for me. I tried to implement the ui element color picker: https://ui5.sap.com/#/entity/sap.ui.unified.ColorPicker

But adding it to a ui I get this error: image

Can someone give me a hint, wht the problem is? I would gues something with the namespace, but I'm not sure

oblomov-dev commented 2 months ago

Merged your changes, thank you!

Can you also share a small sample that we can see the code which exactly creates the error?

Marchl-Woid commented 2 months ago

This would be my small example:

CLASS z2ui5_cl_app_hello_world DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    INTERFACES z2ui5_if_app.
    DATA name TYPE string.
    data color type string.
    DATA check_initialized TYPE abap_bool.

  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    IF check_initialized = abap_false.
      check_initialized = abap_true.

      client->view_display( z2ui5_cl_xml_view=>factory(
        )->shell(
        )->page( title = 'abap2UI5 - Hello World App'
        )->simple_form( editable = abap_true
            )->content(
                )->color_picker(
                  colorstring = client->_bind_edit( color )
*                  displaymode =
*                  change      =
*                  livechange  =
                )->input( client->_bind_edit( color )
        )->stringify( ) ).

    ENDIF.

    CASE client->get( )-event.
      WHEN 'BUTTON_POST'.
        client->message_toast_display( |Your name is { name }| ).
      WHEN OTHERS.
    ENDCASE.

  ENDMETHOD.

ENDCLASS.
oblomov-dev commented 2 months ago

Thank you, added a small fix with https://github.com/abap2UI5/abap2UI5/pull/1325 and now it works:

CLASS zcl_test123123 DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    INTERFACES z2ui5_if_app.
    DATA name TYPE string.
    data color type string.
    DATA check_initialized TYPE abap_bool.

  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zcl_test123123 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    IF check_initialized = abap_false.
      check_initialized = abap_true.

      client->view_display( z2ui5_cl_xml_view=>factory(
        )->shell(
        )->page( title = 'abap2UI5 - Hello World App'
        )->simple_form( editable = abap_true
             )->content( ns = `form`
                )->color_picker(
                  colorstring = client->_bind_edit( color )
*                  displaymode =
*                  change      =
*                  livechange  =
                )->input( client->_bind_edit( color )
        )->stringify( ) ).

    ENDIF.

    CASE client->get( )-event.
      WHEN 'BUTTON_POST'.
        client->message_toast_display( |Your name is { name }| ).
      WHEN OTHERS.
    ENDCASE.

  ENDMETHOD.

ENDCLASS.
Marchl-Woid commented 2 months ago

Hi @oblomov-dev oh great, thanks for the quick help