Announcement

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

    Formatting with ListGridFieldType.TIME locale bug?

    Just noticed that the listGridField.setType(ListGridFieldType.TIME) results in a US Time formatting (i.e. showing a.m. and p.m.) although the locale is set to "de", the widgets show German labels, and no other formatters are in place.
    If this is a bug, is there another way to determine the display format?
    The docs talk about ListGridField.displayFormat or ListGrid.timeFormatter to set the display output for TIME field types but both methods yet do not seem to exists.
    I'd like to avoid a CellFormatter because that would take the ability to do fine granular grouping as a side effect....

    Thanks
    fatzopilot

    SmartGWT 2.2, GWT 2.03, Firefox 3.6.2.

    #2
    Code:
    listgridfield.setCellFormatter(new HourFormat());
    
    
    public static class HourFormat implements CellFormatter {
    		
    		@Override
    		public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
    			if (value != null) {
    				try {
    					if (value instanceof Date) {
    						Date date = (Date) value;
    						return DateTimeFormat.getFormat("HH:mm").format(date);
    					}
    					else {
    						return "";
    					}
    				} catch (Exception e) {
    					return value.toString();
    				}
    			}
    			else {
    				return "";
    			}
    		}
    	}

    Comment

    Working...
    X