2011-12-19 44 views
2

我使用Extensible的日曆http://ext.ensible.com/products/calendar/,但在提交事件日期時,它沒有使用我希望用於MySQL後端的格式。在ExtJS中更改dateFormat不會改變提交的日期

我想讓我的可擴展日曆日期與我的mySql日期格式相匹配,但我不知道是否將其更改爲正確的位置。

這裏是我的EventMappings

Extensible.calendar.data.EventMappings = { 
    EventId:  {name: 'EventId', mapping:'id', type:'int'}, 
    CalendarId: {name: 'CalendarId', mapping: 'roomId', type: 'int'}, 
    Title:  {name: 'Title', mapping: 'description'}, 
    StartDate: {name: 'StartDate', mapping: 'start', type: 'date', dateFormat: 'Y-m-d H:i:s'}, 
    EndDate:  {name: 'EndDate', mapping: 'end', type: 'date', dateFormat: 'Y-m-d H:i:s'}, 
    RRule:  {name: 'RRule', mapping: 'rrule'}, 
    Notes:  {name: 'Notes', mapping: 'notes'}, 
    Reminder: {name: 'Reminder', mapping: ''}, 
    Location: {name: 'Location', mapping: ''}, 
    Url:   {name: 'Url', mapping: ''}, 
    IsAllDay:  {name: 'IsAllDay', mapping: ''}, 
    User: {name: 'User', mapping: 'user'}, 
    Approved: {name: 'Approved', mapping:'approved', type:'boolean'} 
}; 

當我嘗試雖然日期似乎以這種格式發送 Wed Dec 14 2011 01:00:00 GMT-0500 (EST)

我一直在敲我的頭這張貼的更新,我的後臺一段時間,只是無法弄清楚。我還沒有看到任何其他人有同樣的問題,所以我假設我在某個地方做錯了什麼。

任何幫助將是了不起的。謝謝。

+0

在提交日期之前您是否嘗試過console.log(dateFormat)? – 2011-12-19 13:50:28

+0

你,我也注意到了同樣的事情。你可以嘗試使用字符串數據類型,或者覆蓋json writer,或者在你的服務器上進行調整 – 2011-12-19 17:54:04

回答

0

您的商店/代理/讀者/寫者配置是什麼樣的?這個問題不會涉及到EventMappings(其中傳入的數據是從服務器讀取的) - 這與您的應用中的數據層如何在請求中發送日期有關。另外,你正在使用哪個操作系統/瀏覽器?

1

我有一個類似的問題,並通過使用相關日曆視圖(在我的情況下月視圖)的dateParamFormat屬性解決它。

{ 
    xtype: 'extensible.calendarpanel', 
    // the usual settings (calendar and event store, etc.) 
    .. 
    monthViewCfg: { 
    .. 
    // This is it - a custom date format 
    dateParamFormat: 'Y/m/d' 
    } 
}