cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBoxGroup

david_fryda2
Participant
0 Kudos

Hi,

I create a CheckBoxGroup in the Layout View.

In the context, I created a node Root and an attribut a.

I inserted data in the node.

I bound this context to the attribut "texts" of the CheckBoxGroup.

Now the CheckBoxGroup display the data correctly.

How do i get what I selected in this CheckBoxGroup ?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Sorry David , i misunderstood your Question.I guess piyush has addressed your problem.

david_fryda2
Participant
0 Kudos

Hi everyone,

Thanks Piyush for the answer.

Don't worry Baskaran. I sure you could have aswered my question.

About those lines added in the wdDoModifyView method.

I do not understand what are there here to ?

And how can someone guess those trics ? Even if you read the doc, you do not find what to do in order to create a listener for this CheckBoxGroup.

Thanks.

Former Member
0 Kudos

hi David,

Even though the problem is solved i would suggest you to go through this link.

Regards,

Jaydeep

Former Member
0 Kudos

hello David,

i dont have a clear idea about it but the internal variables "checked" and "index" contains the status of the event and we map this to our parameters - "SelectedCheck" and "Position".

just go through the help of UIElement. (right click on the UIE and select Help).

regards,

Piyush.

Former Member
0 Kudos

Generally, UI element event parameters are described in the Javadoc of the <uielement>.mappingOf<eventName>() method, for example see IWDCheckBox.mappingOfOnToggle().

In newer releases, we added an interface for those event parameter names to the UI element interface such that you don't have to use string literals for event parameter names anymore.

Additionally, newer NWDS versions have declarative support for event-parameter-to-action-parameter mapping (PM).

In NW04 you have to write some lines of code in method wdDoModifyView() because this is the only place where you can/should access UI element references:

- <uielement>.mappingOf<eventName>().addSourceMapping(<event parameter name>, <action parameter name>)

Maps existing event parameter to action parameter, such that event parameter value may be received in action handler.

- <uielement>.mappingOf<eventName>().addParameter(<action parameter name>, <value>)

Sets value for action parameter, may be used to identify the event source if different event sources are handled by the same action handler.

See also Chris Whealy: "Inside Web Dynpro for Java" for examples on how/why to use PM.

Armin

david_fryda2
Participant
0 Kudos

Thanks Armin for the clarification.

Nice day

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

I am not sure if i understand your requirements right.

If you want to know the context value at runtime,you may declare that context attribute as calculated(See in properties of the context node) and decide to use getter and setter methods.By doing this you can get and set the context attribute value at runtime.

Former Member
0 Kudos

hello David,

u have to create an event and map it to the onToggle of the check box. the parameters of the event should be "boolean SelectedCheck", "int Position".

now in doModify() write this code:

IWDCheckBoxGroup checkGroup = (IWDCheckBoxGroup) view.getElement("CheckBoxGroup");

checkGroup.mappingOfOnToggle().addSourceMapping("checked","SelectedCheck");

checkGroup.mappingOfOnToggle().addSourceMapping("index","Position");

hope this will help u.

regards,

Piyush.

Former Member
0 Kudos

...or better read the Javadoc:

/**

  • Web Dynpro CheckBoxGroup API.

*

  • CheckBoxGroup represents a multiple selection visualized

  • by a group of check boxes.

  • <p>

  • <strong>Data binding:</strong>

  • <br>

  • The context must provide a node <code>X</code> with <code>X.cardinality = 0..n</code>

  • and <code>X.selection = 0..n</code> with an attribute <code>y</code>. The type of <code>y</code> must be a simple type like <code>String</code>.

  • The number of check boxes is the number of node elements, their texts are the values of attribute <code>y</code>,

  • <b>and the selection of the check boxes is determined by the (multiple) selection of the node.</b>

  • <p>

  • The property <code>texts</code> must be bound to the attribute <code>y</code>.

*/