cancel
Showing results for 
Search instead for 
Did you mean: 

regarding dropdown by index

Former Member
0 Kudos

dear all

i am new to webdynpro for java

i ve 2 drop down by indexes.

first one to display 1 to 8 numbers.

based on selection in fist dropdown i ve to display some thing as follow

for ex: if user select 3 in first dropdown,in second dropdown it should be like 1/3,2/3,3/3.

if in first dropdown he selects 4 ,in second one it should be like 1/4,2/4,3/4,4/4.

it goes for every selection in first dropdown that is 1 to 8 it should reflect in second dropdown as above.

so plz anyone guide me to solution

thanks in advance.

seshu

Accepted Solutions (1)

Accepted Solutions (1)

former_member201361
Active Contributor
0 Kudos

hi,

i Hope u hace created the two Dropdown by Index , first for listing the Values as u have mentioned(1,2,3,4,.....) .

now based on the user input only we have populate the second DropDownByIndex.and u have might have binded a context attribute for the second dropdown.(and also to the first drop down)

if the User selects the first dropdown say "1". get the user selected value from the first dropdown .

String value=wdContext.currentContextElement.geturContextAttributeName();

use if conditional statement.

as if(value =="1"){

populate the second dropdownbyindex.

}

thanks and regards

Fistae

Answers (1)

Answers (1)

former_member201361
Active Contributor
0 Kudos

hi,

For Drop Down By Index we cant use any dictionary , so we have populate the First Drop dwon in the doinit method of the View.

In the View Implementation editor :

In DoInit method :

for (int i=1;i<8;i++){

ITestElement element = wdContext.createTestElement();

element.setData(i);

wdContext.nodeTest().addElement(element);

}

here the test is the node Element and data is the Attribute.

Note : we have create a node element and the Attribute in the Context of the View Controller.

In the First drop down we have On Event Property called OnSelect.

create an Action for thr first DropDown .say the Action Name is PopulateSecondDropDown.

Note : go the Action Tab of the View and create the Action.

Now Switch to the Java Editor of the View .

in the OnActionPopulateSecondDropDown paste this code:

int i1 = wdContext.currentTestElement().getTest();

wdContext.nodeTest1().invalidate();

for(int i=1;i<8;i++){

ITest1Element element = wdContext.createTest1Element();

element.setTest1(i"/"i1);

wdContext.nodeTest1().addElement(element);

}

Hope Ur problem get Resolved

Thanks and regards

Fistae