Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dynamic Checkbox


I need to read the DB tables, based on the table row entries I need to create the checkbox dynamically under the Tray called "Manager".

1. How can i create the multiple checkbox dynamically.

2. How can i add it under the tray..

I went thro some thread, but i could not get much detail..Can anyone give me a code please...

Thanks in advance..

<i>I will reward each useful answer...</i>


Former Member
Former Member replied

Hi Bharati,

The checkbox display depends on the layout that you use.Say if you want to dispaly 5 checkboxes one after the other then deifne layout as GridLayout with colcount 5.

The context attribute that is bind to the checkbox has the boolean value of checked/unchecked

You can get the status of checkbox as

wdContext.current<checkbox node>Element().get<checkbox context attribute>();


Alternate solution

Bharati what I propose is you use checkbox group.

If you use CheckboxGroup then you dont need dynamic creation of checkbox nor you need to worry about the checkbox display.

Assume you need to display 6 checkboxes one after the other with a limitaion of 4 checkboxes in a row.

1.Create a Node say NodeChkbxGrp with attribute chkTexts of type String.The attribute chkTexts will have the values that are to displayed as labels of the checkboxes.

2.create a checkbox group and set the colocunt property to 4.

3. Bind the texts property of checkbox group to context attribute chkTexts.

When you run the application the checkboxes are displayed as shown below

CheckBox1 CheckBox2 CheckBox3 CheckBox4

CheckBox5 CheckBox6

To get the values of the checkboxes that are selected use the following code

String selected = "Selected values = "; // just used to display the checked checkboxes

for(int j=0;j<wdContext.nodeNodeChkbxGrp().size();j++)




selected = wdContext.nodeNodeChkbxGrp().getNodeChkbxGrpElementAt(j).getchkTexts()" ";




0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question