cancel
Showing results for 
Search instead for 
Did you mean: 

checkbox group

Former Member
0 Kudos

Hi

i have a scenario in which i am using a chkboxgroup. now i have added the labels programmatically.

Now wat i want is that wen i select the check boxes the labels of the chk boxes should be displayed in the other view.

for eg if i have 3 chk boxes

sports

music

movies

and i select sports and music then the next view should show that i have selected sports,music.

code would help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi ....Nikhil

To get the label names of the checkbox that you have selected

you can use the folloeing code

<Your Node that u binded to checkbox> nodesport=wdContext.<your node>;

for (int i=0;i<wdContext.currentContextElement().getCount()*2;i++) // here

you have to loop through the all checkbox group elemnts

{

IPrivate<view name>.I<your nodeElemnt> ele=nodesport.get<nodeElement>At(i)

if(nodeSport.isMultiSelected(i))

{

String name =ele.getName();// This will get you the label of the checkbox that you have selected

}

}

by this way you can get the labels of selected checkboxes.

To display it or get them another view first you have to save in the context of the Controller and in other view u can get them...

Regars

Madhavi

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Please go through http://help.sap.com/saphelp_nw04/helpdata/en/0a/16e94d251a164392f3a3415c6d643a/content.htm

See the parameter mapping part

Regards

Ayyapparaj

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi

Assume you have 3 check boxes assigned to 3 labels you are populating these labels in prog

Assume node A contains 3 attr boolean binded to check boxes

Take one more Node B having 3 labels as its attributes

In the Action check the boolean attr

onActionSelectCheck

{

boolean a = wdContext.currentNode<A>Element().get<AttrName>();

if(a)

{

wdContext.currentnodeBElement().setLabel1("Sports or write the Label Text whichever you want");

}else

{

wdContext.currentnodeBElement().setLabel1("");

}

}

Regards

Kalyan

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi

You can populate the label text in context attributes depending upon the selection of check boxes in the action of check box selection and Take this attributes to the other view context via context mapping

In the other view these are available to you.

Regards

Kalyan

Former Member
0 Kudos

Hi venkatakalyan

I do know the procedure but can u tel me dat wen i select a particular checkbox how do i get its value i.e. in wat parameter can it be got.some codin from ur side would really be helpful

Edited by: Nikhil Tapkir on Aug 29, 2008 2:12 PM

Former Member
0 Kudos

Use below code to get the selected checkboxes labels in onActionToggle() method

int size = wdContext.nodeChkGroup().size();

IPrivateCheckboxGroup.IChkGroupNode node = wdContext.nodeChkGroup();

for(int i=0;i<size;i++) {

if(node.isSelected(i))

{

msgManager.reportSuccess(node.getChkGroupElementAt(i).getChkboxItem()+" is selected");

}

}

The above code will display all the labels of selected checkboxes

Hope I answered your question

Thanks

Former Member
0 Kudos

use isMultiSelected(int) instead of isSelected(int)