【问题标题】:How to display Date to Ext Js Column with Json response如何使用 Json 响应将日期显示到 Ext Js 列
【发布时间】:2012-01-13 07:40:16
【问题描述】:

stackoverflow 论坛成员我需要你的帮助。

我正在以 json 格式获取 startDate 的服务器响应 "startDate":1328466599000

我想将它显示到我的 ExtJs 列。但我无法显示它。

我在其中显示 StartDate 的列是 [Ext.Date.format(values.StartDate, "c")] 我的 TaskModel 是

Ext.define("TaskModel", {
        extend : "Gnt.model.Task",

        // Some custom field definitions
        fields : [
            { name: 'Id', type: 'int', useNull : true, mapping: 'id'},
            { name: 'StartDate', type: 'date', mapping: 'startDate'},
            { name: 'EndDate', type: 'date', mapping: 'endDate', dateFormat: 'MS'},
            { name: 'Priority', defaultValue : 1, mapping: 'priority', dateFormat: 'MS' },
            { name: 'Duration', mapping: 'duration'},
             { name: 'PercentDone', mapping: 'percentDone'},
             { name: 'DurationUnit', mapping: 'durationUnit'},
             { name: 'parentId', mapping: 'parentId', type: 'int'},
             { name: 'Name', mapping: 'taskName'},
             { name: 'index', mapping: 'taskindex'},
             { name: 'depth', mapping: 'depth'},
        ]
    });

我无法查看我收到的作为对我的专栏的回复的 startDate。

有没有人知道是什么导致了这个错误?如果有人对此问题有解决方案,请帮助我。

【问题讨论】:

    标签: java json hibernate extjs-mvc


    【解决方案1】:

    可能是您在优先级列上定义了日期格式,而不是在开始日期列上?

    【讨论】:

    • 感谢您的回复,我做到了。通过将 dateFormat 指定为 dateFormat: 'time'
    【解决方案2】:

    我在这里写了一篇博文:http://peterkellner.net/2011/08/24/getting-extjs-4-date-format-to-behave-properly-in-grid-panel-with-asp-net-mvc3/

    很抱歉不久前挖掘了一些东西,但我只是在寻找同样的东西,然后首先看到了我的博客文章(在这个项目之前)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-29
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      • 2018-05-01
      相关资源
      最近更新 更多