我想为ExtJs日历设置一个Json商店。
商店使用Http Proxy来检索它的数据。
商店字段包括startDate和endDate类型为date的对象。
我将我的C#代码中的数据序列化到Json中,这将由Http代理请求。
我想知道我应该序列化开始和结束为一个字符串或C#日期时间类型。
现在我将它们序列化为DateTime类型。.NET DateTime序列化为JSON以用于ExtJs JsonStore(ExtJs日历的事件存储)?
JSON响应看起来是这样的:
{"Data":
"items":[{
"cid":"0",
"end":"\/Date(1275260400000+0100)\/",
"notes":"4:00",
"start":"\/Date(1275260400000+0100)\/",
"title":"Basic""}]
的开始和结束的属性看起来像某种最新的参考。 我试图序列化startDate和endDate作为字符串而不是DateTime类型。 这将返回以下JsonResponse:
{"Data":
"items":[{
"cid":"0",
"end":"03/06/10",
"notes":"4:00",
"start":"04/06/10",
"title":"Basic""}]
然而,当商店已完成加载结束日期且StartDate领域这两种情况下是不确定的。 我应该在这里做什么?
我在想也许我必须将日期格式化为extjs预期的某种格式?
下面是一些示例代码:
this.eventStore = new Ext.data.JsonStore({
id: 'eventStore',
root: 'Data.items',
proxy: new Ext.data.HttpProxy({
url: AppRootPath + 'Calendar/GetCalendarData',
method: 'POST'
}),//proxy
fields: Ext.calendar.EventRecord.prototype.fields.getRange()
});