cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with dropdownbyindex

Former Member
0 Kudos

Hi all,

I have a dropdownbyindex UI element in the screen.I mapped it to a node in the context.That node contains one attribute.I have given 10 elements in the dropdown list.I want to display the element selected using the Messagemanager.

What is the code for that.

thank you.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Consider the dropdownbyindex node to be "DDBINode" and attribute to which DDBI is mapped as "DDBIText".

In any action taht you trigger, write the below code

wdComponentAPI.getMesageManager.reportSuccess(wdContext.currentDDBINodeElement.getDDBIText());

This will display the DDBI selected value in the view.

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

1)Create node(year)with attribute(month)

2)Bind the month attribute to Dropdownbox

3)Write the below code in wdDoInit()

String[] i_monthname={"January", "February", "March", "April",

"May", "June", "July", "August",

"September", "October", "November", "December"};

List i_year=new ArrayList();

for(int i=0;i<i_monthname.length;i++)

{

IPrivateCompView.YearElement i_mon=wdContext.nodeYear().createYearElement();

i_mon.setMonth(i_monthname<i>);

i_year.add(i_mon);

}

wdContext.nodeYear().bind(i_year);

4)create action for dropdown bt click dropdownbyindex ul element--->properties-->onAction=select

5)write this code in onActionSelect()

wdComponentAPI.getMessageManager().reportSuccess(""+wdContext.currentyearelement.getmonth());

Former Member
0 Kudos

IItemsElement selectedItem = wdContext.currentItemsElement();
wdComponentAPI.getMessageManager().reportSuccess("Selected element: " + (selectedItem == null ? "none" : selectedItem.getText()));

assuming the node is named "Items" and the attribute is named "text".

Armin

Former Member
0 Kudos

Hi Armin,

Your solution worked out but i got a new problem.Thank you for solving my previous problem.I have 2 DDBI UI elements in my screen,both are mapped to the same node.I have assigned the different actions for the 2 DDBI.

If i select one value in the 1 DDBI, the other DDBI is also set to the same value.

But my requirement is i have to select 2 different values in the 2 DDBI s and i have to do different manipulations with them.Kindly help me in this matter

Former Member
0 Kudos

If you bind two dropdown-lists to the same node, they will always show the same selection because their selection <b>is</b> the lead selection of the node.

You may either copy the node or use DropDownByKey elements.

Armin

Former Member
0 Kudos

Hi,

I used 2 DDBK UI elements instead of DDBI,but they are also behaving in the same manner,both are setting to the same value if we change the other.

Former Member
0 Kudos

Hi,

You use any DDBI or DDBK,if you map the same node to both the DropDowns then when you select one vlue in one dropdown this also becomes the selected value for the other dropdown, since botht the dropdowns are mapped to the same node.Lead selection is at the node/attribute level and not UI element based.

Instead you have to create Two different node and map the DropDowns to respective nodes.

Former Member
0 Kudos

Only if you bind the "selectedKey" property to the same context attribute. If not, you can have separate selections.

Armin