We are using SmartClient Version: v9.0p_2013-10-17/PowerEdition Deployment (built 2013-10-17).
We have a radio button group where we want to display its values in a particular order so we pass the value map based on some ordering logic. But its key is different from that sort order.
for e.g.:
We have following fruits-
ID Name Sort_Order
1 Apple 1
4 Mango 2
3 Banana 3
2 Kiwi 4
This is happening on Mozilla, Chrome and not on IE8
We want to display these fruits as per the sort order given. Thus i create a LinkedHashMap in that order. But when the rdio group is rendered, it always displays the radio items sorted by its ID which is the key in the map.
Here is the sample code snippet :
Result is(sorted by the keys):
o Apple o Kiwi o Banana o Mango
We want the linked hash map order to be maintained when the radio group is drawn which is
o Apple o Mango o Banana o Kiwi
We have a radio button group where we want to display its values in a particular order so we pass the value map based on some ordering logic. But its key is different from that sort order.
for e.g.:
We have following fruits-
ID Name Sort_Order
1 Apple 1
4 Mango 2
3 Banana 3
2 Kiwi 4
This is happening on Mozilla, Chrome and not on IE8
We want to display these fruits as per the sort order given. Thus i create a LinkedHashMap in that order. But when the rdio group is rendered, it always displays the radio items sorted by its ID which is the key in the map.
Here is the sample code snippet :
Code:
public void onModuleLoad() { VLayout vlayout = new VLayout(); DynamicForm form= new DynamicForm(); vlayout.addMember(form); RadioGroupItem radioBtn = new RadioGroupItem("Fruits", "Fruits"); LinkedHashMap<Integer, String> map = new LinkedHashMap<Integer, String>(); map.put(1, "Apple"); map.put(4, "Mango"); map.put(3, "Banana"); map.put(2, "Kiwi"); radioBtn.setValueMap(map); radioBtn.setDefaultValue(1); form.setItems(radioBtn); vlayout.draw(); }
o Apple o Kiwi o Banana o Mango
We want the linked hash map order to be maintained when the radio group is drawn which is
o Apple o Mango o Banana o Kiwi
Comment