Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DateItem picklist - month as number

    By default the month is a text value in the select list (Jan, Feb, March etc.), in case you want to show a number instead of the text use this. Hope this helps someone!

    Code:
    final LinkedHashMap<String, String> monthValueMap = new LinkedHashMap<String, String>();
    monthValueMap.put("0", "1");
    monthValueMap.put("1", "2");
    monthValueMap.put("2", "3");
    monthValueMap.put("3", "4");
    monthValueMap.put("4", "5");
    monthValueMap.put("5", "6");
    monthValueMap.put("6", "7");
    monthValueMap.put("7", "8");
    monthValueMap.put("8", "9");
    monthValueMap.put("9", "10");
    monthValueMap.put("10", "11");
    monthValueMap.put("11", "12");
    
    final SelectItem monthSelectItem = new SelectItem("Month");
    monthSelectItem.setValueMap(monthValueMap);
    
    final DateItem nextShipment = new DateItem();
    nextShipment.setName("nextShipment");
    nextShipment.setMonthSelectorProperties(monthSelectItem);
    
    ...
Working...
X