EXT Scheduler - cannot create view preset
I am attempting to change the calendar header date layout in EXT Scheduler. I've copied the section of code from the customer header demo, made a few changes, and dropped it into my code.
The problem is I get "Sch.preset is undefined", where I'm executing "Sch.preset.Manager.registerPreset("weekView", weekView);". I'm not sure of this is a scoping issue or whether I'm missing some code completely.
Ext.onReady(function () {
var weekView = {
displayDateFormat : 'Y-m-d',
shiftIncrement : 1,
shiftUnit : "WEEK",
timeResolution : {
unit : "DAY",
increment : 1
},
headerConfig : {
bottom : {
unit : "DAY",
dateFormat : 'D d M'
},
middle: {
unit : "QUARTER",
renderer : function(start, end, cfg) {
var quarter = Math.floor(start.getMonth() / 3) + 1,
fiscalQuarter = quarter === 4 ? 1 : (quarter + 1);
return "" //Ext.String.format('FQ{0} {1}', fiscalQuarter, start.getFullYear() + (fiscalQuarter === 1 ? 1 : 0));
}
},
top : {
unit : "YEAR",
cellGenerator : function(viewStart, viewEnd) {
开发者_StackOverflowvar cells = [];
// Simplified scenario, assuming view will always just show one US fiscal year
return [{
start : viewStart,
end : viewEnd,
header : 'Fiscal Year ' + (viewStart.getMonth() + 1)
}];
}
}
}
};
Sch.preset.Manager.registerPreset("weekView", weekView);
Sked.init();
});
Try
Sch.PresetManager.registerPreset("weekView", weekView);
精彩评论