cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown Issue

Former Member
0 Kudos

Hi Friends,

I have a table that is bind to a model node through component controller. I have added two columns: one has a DropDownByIndex element and another a button . The values for the dropdown is got from a model. The values are getting populated. When i click on the button i should be able to read the value selected in the dropdown for that row. wdContext.current<dropdown>Element. - always return the first index as selected.

Am i missing something? Thanks in advance.

Thanks

Nathan.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

Thanks for your ideas. It works if i use DropDownByKey and valueset approach.

Nathan.

Former Member
0 Kudos

Don't think you should use dropdownbyindex as you as it's based on the leadselection of value table you indexed. No matter what you choose it'll affect all dropdowns of the table control.

using dropdownbykey instead so that each field is unique to itself, then populate the key with the code:

I<VALUE_TABLE>Element Ele;

int cntEle = wdContext.node<VALUE_TABLE>().size();

IWDAttributeInfo attrInfo = wdContext.node<TABLE>.getNodeInfo().getAttribute("<DROPDOWNFIELDNAME>");

ISimpleTypeModifiable msType = attrInfo.getModifiableSimpleType();

IModifiableSimpleValueSet ValueSet = msType.getSVServices().getModifiableSimpleValueSet();

//Put empty field
ValueSet.put(<EMPTY_VALUE>," ");

//loop and add the dropdown list
for(int i=0; i<cntEle; i++){
Ele = wdContext.node<VALUE_TABLE>().get<VALUE_TABLE>ElementAt(i);
ValueSet.put(Ele.get<CODE>(),Ele.get<DESC>());
}

good luck

Former Member
0 Kudos

Hi Jansen,

Thanks for the tip. Do we have to initialize Ele (I<VALUE_TABLE>Element Ele)? Coz i am getting a null pointer exception. If yes how to do it?

I have to fill the dropdown in the wdDoModifyView right? will it show the key codes in the dropdown or the description? I need to show the description. And there is a dropdown for each row of the table.

The exception is raised at ISimpleTypeModifiable msType = attrInfo.getModifiableSimpleType(); -

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(MyBookingsView.Reasoncode.Caatrt): must not modify the datatype of a mapped attribute

The dropdown column is an additional column.

Thanks

Nathan.

Former Member
0 Kudos

Do you need different dropdown list entries per table row? If yes, you cannot use *ByKey but have to use *ByIndex.

Add a non-singleton child node "ListItems" (cardinality = 0:N, selection = 0:1) to the data source node "Rows" of the table, add an attribute "Text" to "ListItems" and use a supply function to fill the dropdown entries for a given row. Then the selected list entry in row #i is given by

IRowsElement row = wdContext.nodeRows().getRowsElementAt(i);
int selectedListIndex = row.nodeListItems().getLeadSelection();

Armin

former_member186016
Active Contributor
0 Kudos

It is because always the the first row is selected.

Even if you click on any button in other row, you might not have changed the selected row.

You can change the lead selection. And then try to access the current<Node>Element.

Try this.

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

Hi,

No. You got me wrong. I have handled onLeadSelect and i am able to read the the column values of the row selected. But the dropdown always returns the first index.

Thanks

Nathan.

Former Member
0 Kudos

Hi

Then what you want in the DropDown?

Rgds

-SS

former_member365727
Active Contributor
0 Kudos

Hi,

Have u set the node property to Non-Singleton for the dropdown?

If possible try to post the context structure..

Regards

Srikanth