【发布时间】:2011-07-03 11:08:34
【问题描述】:
我已经设置了一个 ExtJs 日历。然而,即使我没有调用 store.load 方法,商店最初也会加载 4 次。我只是想知道这是从哪里调用的?因为它还会以错误的格式向服务器发送开始日期和结束日期。即它以 m/d/y 格式发送日期,而服务器期望 d/m/y?
this.eventStore = new Ext.data.JsonStore({
id: 'eventStore',
root: 'Data.items',
proxy: new Ext.data.HttpProxy({
url: AppRootPath + 'Calendar/GetCalendarData',
method: 'POST'
}),//proxy
fields: [
{name:'StartDate', mapping: 'start', type: 'date', dateFormat: 'd F Y'},
{name:'EndDate', mapping: 'end', type: 'date', dateFormat: 'd F Y'},//H:i:s
{name:'Title', mapping: 'title', type: 'string'},
{name:'Notes', mapping: 'notes', type: 'string'},
{name:'CalendarId', mapping: 'cid', type: 'string'}]
});
日历:
this.calendar = new Ext.calendar.CalendarPanel({
activeItem: 2,
id: 'calendar',
eventStore: this.eventStore,
calendarStore: this.calendarStore,
headerCfg: {
tag: 'center',
cls: 'x-panel-header x-unselectable'
},
monthViewCfg: {
showHeader: true,
showWeekLinks: true,
showWeekNumbers: true
},
title: 'My Calendar', // the header of the calendar, could be a subtitle for the app
listeners: {
'eventclick': {
fn: function(vw, rec, el){
alert('@EventClicked');
debugger
},
scope: this
},
'dayclick': {
fn: function(vw, dt, ad, el){
alert('@DayClicked');
},
scope: this
},
'viewchange': {
fn: function(p, vw, dateInfo){
updateTitle.apply(this, [dateInfo.viewStart, dateInfo.viewEnd]);
Ext.getCmp('app-nav-picker' + config.id).setValue(dateInfo.activeDate);
},
scope: this
},
'eventmove': {
fn: function(vw, rec){
rec.commit();
//var time = rec.data.IsAllDay ? '' : ' \\a\\t g:i a';
//this.showMsg('Event '+ rec.data.Title +' was moved to '+rec.data.StartDate.format('F jS'+time));
},
scope: this
}
}
});
我认为 load 方法是从 Calendar-all.js 文件中调用的。但是我找不到确切的位置? 我可以拦截这些加载调用以确保日期格式正确吗?
【问题讨论】:
-
我在 ExtJS 3.3.1 中找不到 CalendarPanel。你从哪里弄来的?
-
这是一个扩展,示例可以在这里找到:dev.sencha.com/deploy/dev/examples/calendar/index.html