cancel
Showing results for 
Search instead for 
Did you mean: 

how to make enable UI elements Check box

Former Member
0 Kudos

Hi ,

I am creating UI elements Check box in a view dynamically at runtime.

But its is in uneditable mode.(gray out)

-


my Code:

-


IWDCheckBox cb1 = (IWDCheckBox)view.createElement (IWDCheckBox.class,optdetials[1]);

cb1.setText(optdetials[2]);

root.addChild(cb1);

-


Now my problem is how to make this check box enable.

and aslo tell me how to create Radio button dynamically.

Thanks

Ravi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ravi,

Go through the following

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/developi...

Follow the below steps:

1. Create a ValueAttribute "ChkGroup" and following valueattributes under the above valueattribute

check (boolean)

text (string)

2. Type the following in init() method

IPrivate<<VIEW>>.IChkGroupElement ele=wdContext.createChkGroupElement();

ele.setCheck(true);

ele.setText("1");

wdContext.nodeChkGroup().addElement(ele);

IPrivate<<VIEW>>.IChkGroupElement ele1=wdContext.createChkGroupElement();

ele1.setCheck(true);ele1.setText("11");

wdContext.nodeChkGroup().addElement(ele1);

3. Write the following in wdDoModifyView() method

IWDCheckBoxGroup grp1=(IWDCheckBoxGroup)view.createElement(IWDCheckBoxGroup.class,null);

grp1.bindTexts("ChkGroup.text");

grp1.bindEnabled("ChkGroup.check");

<<Container>>.addChild(grp1);

Regards, Anilkumar

Message was edited by:

Anilkumar Vippagunta

Former Member
0 Kudos

Hi,

Create a value attribute "checked" of type boolean.

Now try the following

IWDCheckBox cb1 = (IWDCheckBox)view.createElement (IWDCheckBox.class,null);

cb1.setText("Text");

cb1.bindChecked("checked");

"Checked" property is the one you need to makesure while creating the checkbox.This property should be bound to a valueattribute of type boolean

Regards, Anilkumar

Message was edited by:

Anilkumar Vippagunta

Former Member
0 Kudos

I am getting error.

And without binding to the context, can we eanble.

Because i want to create mulitple checkboxes.

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Ravi

No, You can't create CheckBox without binding to the context because it needs to save value of 'checked' property somewhere. Context is the only place for storing 'checked' property. The same is for RadioButton. You need to bind its 'selectedKey' property to the context.

If you need to create several check boxes dynamically you have to create dynamically the boolean attributes in the context too... and use them for binding.

Another possible way in your case is using CheckBoxGroup. The control will display required number of check boxes dunamically based on the number of elements in the context node bound to it. Let me if you need more info about the control.

BR

Sergei

Former Member
0 Kudos

Can you elobrate the last point ( control)

Former Member
0 Kudos
Former Member
0 Kudos

Still i need more help.

Bocoz i am creating UI Dynnamically.