Date类型的数据在GridPanel里的显示问题

对于GridPanel里面的日期数据列:
RecordDef里面定义为:

  1. RecordDef recordDef = new RecordDef(   
  2.                 new FieldDef[]{   
  3.                         new StringFieldDef("company"),   
  4.                         new FloatFieldDef("price"),                      
  5.                         new DateFieldDef("dates")//日期类型
  6.                 }   
  7.         );  

 

ColumnConfig[]定义:

  1. ColumnConfig[] columns = new ColumnConfig[]{   
  2.                 //column ID is company which is later used in setAutoExpandColumn   
  3.                 new ColumnConfig("Company""company", 160, truenull"company"),   
  4.                 new ColumnConfig("Price""price", 35),                  
  5.                 new ColumnConfig("Last Date""dates", 65,true,new DateRenderer("yyyy-MM-dd")),                   
  6.         };   

 

DateRenderer类的定义如下:

  1. public class DateRenderer implements Renderer {
  2.     private DateTimeFormat dateTimeFormat;
  3.     public DateRenderer(String format) {
  4.         this.dateTimeFormat = DateTimeFormat.getFormat(format);
  5.     }
  6. //  public DateRenderer() {
  7. //      this.dateTimeFormat = DateTimeFormat.getFormat("dd.MM.yyyy");
  8. //  }
  9.     public String render(Object value, CellMetadata cellMetadata,
  10.             Record record, int rowIndex, int colNum, Store store) {
  11.         return value != null ? dateTimeFormat.format((Date) value) : "";
  12.     }
  13. }

 

你可能感兴趣的:(Date,null)