cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic UI Element multiple times

Former Member
0 Kudos

Dear all.

I am able to create one dynamic UI element, and bind to a node.

Now the point is my node is of cardinaly 0..n.

Based on some logic, there can be various (or 0) text edit UI element dynamically.

How can I write this code? Any help is greatly appreciated.

Thanks in adv!

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You will need to follow the same rules as if you were designed this multi-item in the view designer - use one of the iterator controls as a parent. Things like rowRepeater or MultiPane will take care of the proper binding to the x:n cardinality and generate the proper number of child UI elements. Otherwise you would not be able to generate the correct binding strings.

Answers (2)

Answers (2)

pranav_nagpal2
Contributor
0 Kudos

Hi,

Check this code

data: LR_CONTAINER type ref to CL_WD_UIELEMENT_CONTAINER,
LR_BUTTON type ref to CL_WD_BUTTON,
LR_FLOW_DATA type ref to CL_WD_FLOW_DATA.

do 10 TIMES.
LR_BUTTON = CL_WD_BUTTON=>NEW_BUTTON( ).
LR_FLOW_DATA = CL_WD_FLOW_DATA=>NEW_FLOW_DATA( element = LR_BUTTON ).
LR_CONTAINER ?= view->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
LR_CONTAINER->ADD_CHILD( LR_BUTTON ).
enddo.

it is for inserting 10 buttons on the same basis you can insert number of text views......

regards

Pranav

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>it is for inserting 10 buttons on the same basis you can insert number of text views......

Actually you couldn't use this same approach because you would be able to generate the mandatory binding strings to the context node.

Yashpal
Active Contributor
0 Kudos

Hi ,

try with row repeater ui element.

Regards

Yash