cancel
Showing results for 
Search instead for 
Did you mean: 

Order of items in DropDownByKey

Former Member
0 Kudos

Hi guys,

I found the DropDownByKey will sort the order or items by its key, but I don't want such an order. How to do this?

The items are loaded to the DropDownByKey by:

IModifiableSimpleValueSet valueSet = matGrpType.getSVServices().getModifiableSimpleValueSet();

valueSet.put(key1, value1);

valueSet.put(key2, value2);...

How the set the order of the items by the order which is added by the previous way?

Thank you very much!

Xiaoming Yang

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

I dint find that the item is not sorted.

I tried the code and seen the output,its coming the way i have inserted.

ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("ddkval");

IModifiableSimpleValueSet val=myType.getSVServices().getModifiableSimpleValueSet();

val.put("3","ddd");

val.put("1","aaa");

val.put("5","bbb");

val.put("2","ccc");

Regards,

Vijayakhanna

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi yang,

To avoid getting items sorted, you can always set the desired values by varying the 'key' order.

Srinivasan T

Former Member
0 Kudos

Hi srinivasan:

Thanks for you tip, however the key/text is got from BAPI and can't be changed manually.

Thanks,

Xiaoming Yang

Former Member
0 Kudos

<a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/dr/com/sap/typeservices/IModifiableSimpleValueSet.html#sort(java.util.Comparator)">This</a> might help.

Armin

Former Member
0 Kudos

Xiaoming,

Could you post complete code?

Namely, how variable "matGrpType" is obtained?

Because actually (as noted) in modifiable set items are shown in insertion order...

VS