cancel
Showing results for 
Search instead for 
Did you mean: 

Default selection of an item in DropDownByIndex

Former Member
0 Kudos

Hi,

I have few dropdowns (dropdownbyindex) in a table. I need to make default selection of an item in the dropdown.

for example if one of my dropdown has values "A","B","C","D". I want to show B as selected. How can we do this?

Any help?

regards,

Sujesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You must have bound the texts property of the dropdown to some context node. Just set the leadselection of that node.

For example, if your context looks like

-Root

--DataNode

---Text() (value attribute mapped to textx property.)


wdContext.nodeDataNode().setLeadSelection(1);

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajith,

I won't know the index 1. I have only value "D" with me

regards,

Sujesh

Former Member
0 Kudos

Hi,

Then do this:


int lead = 0;
for(int i = 0; i < wdContext.nodeDataNode().size; i++){
IWDNodeElement elem = wdContext.nodeDataNode().getElementAt(i);

if(elem.getAttributeAsText("Text").equalsIgnoreCase("D"))
{
lead = i;
break;
}
}

wdContext.nodeDataNode().setLeadSelection(lead);

Regards,

Satyajit.

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

wdContext.CurrentDataNodeElement.Set<Attribute>.("B");

Regards,

Vijayakhanna Raman

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this,

when load the node values check the selected value in the adding list and set it as lead selected.

IPrivate<ViewName>.IReceiverNode nodeReceiver=wdContext.nodeReceiver();

for(int k=0;k<wdContext.nodeReceiver().size();k++) {

String curentvalue=String.valueOf(((IPrivate<ViewName>.IReceiverElement)(wdContext.nodeReceiver().getElementAt(k))).get<Param>());

if(curentvalue.equals("B")){

nodeReceiver.setLeadSelection(k);

}

}

Kind Regards

Mukesh