Jsp 在JqGrid中格式化Joda LocalDate

Jsp 在JqGrid中格式化Joda LocalDate,jsp,datepicker,jqgrid,jodatime,jsp-tags,Jsp,Datepicker,Jqgrid,Jodatime,Jsp Tags,我正试图在jqGrid中转换jodaDateFormat 我的实体类中的声明是: @Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDate") @DateTimeFormat(iso=ISO.DATE) @Column(nullable=false) private LocalDate dateStart; 为了在视图中查看此日期,我尝试在tagx文件中插入以下javascript转换: <script ty

我正试图在jqGrid中转换jodaDateFormat

我的实体类中的声明是:

@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
@DateTimeFormat(iso=ISO.DATE)
@Column(nullable=false)
private LocalDate dateStart;
为了在视图中查看此日期,我尝试在tagx文件中插入以下javascript转换:

<script type="text/javascript">
<![CDATA[
jodaLDFormatter = function (cellValue, options) {
    if(cellValue) {
        return $.datepicker.formatDate(
            'dd/MM/yyyy', 
            new Date(cellValue['year'], 
                    cellValue['monthOfYear']-1, 
                    cellValue['dayOfMonth']));
    } else {
        return '';
    }
};

在JSP页面中,我以以下方式声明该列:

<table:jqcolumn id="l_list_dateStart" property="dateStart" formatter="jodaLDFormatter"/>

但我得到这个:(从页面的来源)

NaN/NaN/NaNNaN
我不想转换字符串中的每个日期,以便在jqGrid中看到它


什么是正确的方法

我认为您没有将Joda对象传递给视图。您可能会从控制器发送一个向量,如
[日、月、年]

如果我的猜测是正确的,您可以将其添加到
colmodel
中:

formatter: 'date', srcformat:'dd/mm/yy', date:'true'

您需要在formatoptions中设置srcformat和newformat选项。默认格式为ISO日期(Y-m-d)
formatter: 'date', srcformat:'dd/mm/yy', date:'true'