cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Texts in DropDownList

Former Member
0 Kudos

Hi Experts,

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

i need some info ab't it.

Thank U!!

Ravi Aswani

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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