Skip to Content
avatar image
Former Member

Insert Texts in DropDownList

Hi Experts,

How can i add values or texts to my dropdownbyindex element.

i need some info ab't it.

Thank U!!

Ravi Aswani

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 01, 2008 at 05:49 AM

    Hi,

    The value node in the example below is defined as follows:

    Value node "MonthsOfYear", collection type=list, cardinality=0..n, selection=0..1

    and the attribute:

    Value attribute "MonthNameu201D, type=u201DStringu201D.

    place this code in DoInit Method of View.

    String[] monthNames = new String []

    {

    "January", "February", "March", "April",

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

    "September", "October", "November", "December",

    };

    //1. Create context elements for node "MonthsOfYear"

    List monthsOfYear = new ArrayList();

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

    {

    IPrivateMainView.IMonthsOfYearElement month = wdContext.createMonthsOfYearElement();

    month.setMonthName(monthNames<i>);

    monthsOfYear.add(month);

    }

    and bind Value attribute "MonthNameu201D to DropDownByIndex UI Element.

    for further information follow this link,

    http://help.sap.com/saphelp_nw70/helpdata/EN/95/93fe1e71a2e44691b1f041e67f71aa/content.htm

    Regards,

    ramesh.

    Edited by: Ramesh Babu V on Sep 1, 2008 11:19 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 05:55 AM

    Hi,

    Try this way.

    for(int i=0;i<<size of data>;i++)

    {

    IPrivate<ViewName>.I<DDNode>Element element=wdContext.create<DDNode>Element();

    element.set<attribute1>(<value1>);

    element.set<attribute2>(<value2>);

    element.set<attribute3>(<value3>);

    etc....

    wdContext.node<DDNode>.addElement(element);

    }

    Regards

    LN

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 05:56 AM

    Hi

    theres another way to this go to dictionary-->loacl dictionary -->simple types right click on simple types put in sipmle type name give some valid package name by pressing the browse button.

    doble click on the simple type u have created and then go to enumaration tab.

    press on new

    add the values u want to be displayed in the drop down list

    Now in create a context that u are going to map to the texts property in the dropdown by index element.

    now change the type of this context elment to the simple type u have created.

    Edited by: Nikhil Tapkir on Sep 1, 2008 7:56 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 05:56 AM

    Hi Aswani,

    First create a ValueNode named some ' Emp ' in the Context & take one Attribute named ' Id ' of type String for the node( Emp ) in the Context.

    Take the Cardinality Property for the Context Node Emp as 0..n & Selection Property for the Node Emp as 1..1

    Take DropDown UI element in the Layout Tab & bind Texts Property of that UI element to context attribute ' Id ' ( Emp.Id )

    Now in the Coding Part Take like this

    IPrivate<ViewName>.IEmpElement element;

    for(int i=0;i<3;i++)

    {

    element = wdContext.createEmpElement();

    element.setId("Employee Id "+i);

    wdContext.nodeEmp().addElement(element);

    }

    With Regards,

    Roop Kumar.

    Edited by: Roop kumar Annavarapu on Sep 1, 2008 7:59 AM

    Add comment
    10|10000 characters needed characters exceeded