cancel
Showing results for 
Search instead for 
Did you mean: 

Check box - checking

Former Member
0 Kudos

All,

I created the checkbox dynamically, but i could not check it at runtime..

Here is my code:



	  IWDCheckBox cb = (IWDCheckBox) view.createElement(IWDCheckBox.class, "checkbox1" ) ;
	  cb.bindChecked("Checked_ch1"); 
	  
	  cb.setEnabled(true);
	  cb.setReadOnly(false);
	  cb.setText("Test Checkbox");

	  IWDTray cont= (IWDTray) view.getElement("tray1");
	  cont.addChild(cb);

What is missing...

Thanks in advance..

BM

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Create the attribute of type boolean and try this code.

IWDAttributeInfo Checked_att=wdContext.getNodeInfo().addAttribute("val1","ddic:com.sap.Boolean");

IWDCheckBox cb = (IWDCheckBox) view.createElement(IWDCheckBox.class, "checkbox1" ) ;

cb.bindChecked(Checked_att);

cb.setEnabled(true);

cb.setReadOnly(false);

cb.setText("Test Checkbox");

IWDTray cont= (IWDTray) view.getElement("tray1");

cont.addChild(cb);

Regards,

Vijai

Answers (3)

Answers (3)

Former Member
0 Kudos

You forgot to link yours check box with action:

cb.setOnToggle(wdThis.wdGetSomeAction());

Former Member
0 Kudos

Hi,

Check the cardinality of your checkbox node.

If you have created a node for checkbox and trying to add a attribute dynamically to the node,then first set the cardinality of the node to 1..n

or else you have to create the node element for cardinality 0..n

Even i faced the same problem and by changing the checkbox node cardinality to 1..n i was able to check the dynamically created checkbox.

Former Member
0 Kudos

HI Bharathi,

u have to bind the state of chec box to context attribute which is of type boolean.

cb.bindState(IWDAttributeInfo attributeInfo);

hope this helps to u

With Regards

Naidu