cancel
Showing results for 
Search instead for 
Did you mean: 

Adding ui_element dynamically to a view in a specific position

matteo_montalto
Contributor
0 Kudos

Hi all experts,

shorty:

I'm working on a view (IF_WD_VIEW), which has several containers that contain some UI_ELEMENTs.

Now, given a specific UI_ELEMENT, say, an inputfield named "X", I'd like to add an UI element before it.

An example could be helpful: I see in debug that my view has a lot of elements, something like this:

ROWID
VIEW_ELEMENT
...

211ABC->{O:3870*\CLASS=CL_WD_MATRIX_HEAD_DATA}
212BCD->{O:3871*\CLASS=CL_WD_INPUT_FIELD}
......

I'd like to add a specific UI element (e.g., a Text View element, obviously with MatrixHeadData layout) in position 210, before the inputfield "ABC" shown in example.

I now that I can use the following syntax to add an element in position:

<my_container>->add_child( index = <my_index> the_child = <my_UI_element> ).

However, I don't find a way to get the index (row number) of the element 'ABC"...how can I do that?

Thanks


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If i am not wrong you are talking to add some UI element in a Table at a specific index and column, If yes then in WDP its not possible. whatever you add in a column will be visible for all row..

.. Chans..

matteo_montalto
Contributor
0 Kudos

Nope, the example is a sketch of what I see exploring IF_WD_VIEW-ELEMENTS table... Shortly, it's an (huge) list of ui elements with a row index that build up the view itself.

My idea is to create dynamically an UI element (textview) and add it in a certain position.

Former Member
0 Kudos

Hello,

Suppose u want to add a text view in starting.

so here i am taking reference of  'ROOTUIELEMENTCONTAINER'

  lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

  cl_wd_matrix_layout=>new_matrix_layout(

    EXPORTING

      container              =    lr_container ) .

you can read any container like this where you want to add your textview.

Here i am creating new textview.


  DATA: lri_tom_6 TYPE REF TO cl_wd_text_view.

    lri_tom_6 = cl_wd_text_view=>new_text_view(

      id = `TXT_BID`

      bind_text = 'NODE_USR_BOOK.BOOK_ID'

    ).

Now you need to add this newly added Text view into your desired container.


lr_container ->add_child( lri_tom_6 ).

..

Hope i am able to help you.