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

How to create dropdownbykey or index inside a table

I have a table created in design time. This table is meant for the user to enter some data at runtime.

I tried to change the tableCellRender to DropDownByIndex or Key.

I populated the table with three rows using the following statement:

wdContext.nodeCONDITIONS_valueNode().addElement(wdContext.createCONDITIONS_valueNodeElement());

Now I use the following code snippet from WebDynpro Help to populate the dropdown with values:

String[] conditionItems = new String []{"A", "B", "C", "D"};

List nodeElements = new ArrayList();

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

{

IPrivateCreateLoanView.ICONDITIONS_valueNodeElement conditionsElement = wdContext.createCONDITIONS_valueNodeElement();

conditionsElement.setCONDITION_TYPE(conditionItems<i>);

nodeElements.add(conditionsElement);

}

wdContext.nodeCONDITIONS_valueNode().bind(nodeElements);

wdContext.nodeCONDITIONS_valueNode().setLeadSelection(1);

What I expect is the table to render with dropdown showing the list of values: A,B,C,D. This comes up fine. When I select a value in any dropdown of the table, the values in the other dropdowns are changed as well!

How do I get over this?

Thanks in advance,

reza

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 08:24 AM

    Hi Mohammed,

    I couldn't make out much from your code. Anyway the steps that you need to follow to show a DropDownByKey in a table is given below. I assume, you need to populate the values dynamically and you want to show the same list of entries for all the rows.

    1) Create an attribute of type 'String' inside the node bound to your table's 'datasource' property. Let us call this attribute 'drop_attrib'.

    2) Create a DropDownByKey UI element as the cell edtor of a table column and bind it's 'selectedKey' attribute to 'drop_attrib'.

    3) Now populate the attribute in your code :

    final IModifiableSimpleValueSet ValueSet= wdContext.getNodeInfo().getChild("<your table node>").getAttribute("drop_attrib").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

    // populate the valueset with some values , eg:

    ValueSet.put("A","A");

    ValueSet.put("B","B");

    ValueSet.put("C","C");

    ValueSet.put("D","D");

    Now when you create different elements for the table node (node bound to the table), the dropdown list will be automatically created.

    Hope this helps,

    Best Regards,

    Nibu.

    (Please consider awarding points if you find the replies as useful ones 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 09:02 AM

    Add a <b>non-singleton</b> node "Items" with an attribute "Text" under the table's data source node "Rows".

    To add items for row i:

    IRowsElement row = ...; /* Row element at index i */
    for (int j = 0; j < numItems; ++j)
    {
      IItemsElement item = row.nodeItems().createItemsElement();
      row.nodeItems().addElement(item);
      item.setText("Item " + j);
    }

    Bind the DropDownByIndex.texts property to attribute Rows/Items/@Text.

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 11:04 AM

    Dear Nibu,

    Can you pl. guide me to create same from Model . I am need to rtrieve Material list for a customer inside a table.

    Regards,

    Prakash

    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.