Skip to Content
author's profile photo Former Member
Former Member

how to hard code values in drop down by index

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 01:41 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 01:31 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 04:26 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2007 at 06:07 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.