cancel
Showing results for 
Search instead for 
Did you mean: 

how to hard code values in drop down by index

Former Member
0 Kudos

Hi everyone

I hav a node containing 2 attributes ie value n key. I am using drop down by index. Value attribute is bound to my drop dwn box. In key I am providing key value for the value. I need to hard code 3 value..Can anyone help me how to do so.

Thanks

Jaspreet Kaur

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

IPrivate<viewname>.I<nodename>Element ele = wdContext.node<nodename>().create<nodename>Element();

ele.setValue(<value>);

ele.setKey(<Key>);

wdContext.node<nodename).addElement(ele);

IPrivate<viewname>.I<nodename>Element ele1 = wdContext.node<nodename>().create<nodename>Element();

ele1.setValue(<value>);

ele1.setKey(<Key>);

wdContext.node<nodename).addElement(ele1);

IPrivate<viewname>.I<nodename>Element ele2 = wdContext.node<nodename>().create<nodename>Element();

ele2.setValue(<value>);

ele2.setKey(<Key>);

wdContext.node<nodename).addElement(ele2);

Warm Regards,

Murtuza

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Let the attributes in your node be 'key' and 'val'.

Then bind 'texts' property of the 'dropdown by index' to val.

Then write coding,

IPrivate<yourViewName>.I<yourNodename> myNode=wdContext.node<yourNodename>();

IPrivate<yourViewName>.I<yourNode'selementname> myElement;

<b>myElement=myNode.create<yourNodeElement>();

myNode.addElement(myElement);

myElement.setKey("K1");

myElement.setVal("Val1");</b>

Repeat the last 4 lines with your desired key and value.

thanks

Smitha

Former Member
0 Kudos

Hi,

Example for Data Binding of the DropDownByIndex UI Element:

Procedure at design time:

...

1. Create a view with the name TestView.

2. Insert the DropDownByIndex UI element as a container child of the TestView view. (Step 1)

3. Create the context structure, as described in step 2.

Create the context node X with the cardinality 0..n. Insert the value attribute y of the type String into this node. Then perform the data binding of the DropDownByIndex UI element in the Properties window of the View Designer. The texts property must be bound to the value attribute y with the context path description TestView.X.y (step 3).

The context path TestView.X.y describes the attribute y in the context node X of the view context of the TestView view.

You can fill the context with test data using the following controller implementation.

public void wdDoInit()

{

//@@begin wdDoInit()

String[] letters = new String []

{"A", "B", "C", "D"};

//Create context elements for the node "X"

List nodeElements = new ArrayList();

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

{

IPrivateTestView.IXElement xElement = wdContext.createXElement();

xElement.setY(letters<i>);

nodeElements.add(xElement);

}

//Bind node element list to the node

wdContext.nodeX().bind(nodeElements);

//Set node’s lead selection which determines the selected item

wdContext.nodeX().setLeadSelection(1);

//@@end

}

Regards

Ayyapparaj

Former Member
0 Kudos