Ext.ns('App');
Ext.Loader.setConfig({
enabled: true,
disableCaching : true,
paths : {
'App' : './js'
}
});
Ext.require([
'App.PHPScheduler',
]);
Ext.onReady(function() {
App.SchedulerDemo.init();
});
App.SchedulerDemo = {
// Initialize application
init : function() {
Ext.define('CustomResource', {
extend: 'Sch.model.Resource',
fields : [
{name: 'Capacity', type: 'number'}
]
});
var resourceStore = Ext.create("Sch.data.ResourceStore", {
model : 'Sch.model.Resource',
//limit resources to 5 per page
pageSize : 5,
autoSync: true,
proxy : {
type : 'ajax',
method: 'POST',
reader: {
type : 'json',
root : 'root',
//name of the response property containing nuber of all records
totalProperty : 'total'
},
api: {
read: 'r-read.php',
create: 'r-create.php',
destroy: 'r-destroy.php',
update: 'r-update.php'
},
writer : {
type : 'json',
root: 'data',
encode: true,
writeAllFields: true,
listful : true,
allowSingle: false
}
}
});
var eventStore = Ext.create("Sch.data.EventStore", {
autoLoad: true,
autoSync: true,
proxy : {
type : 'ajax',
method: 'POST',
reader: {
type : 'json',
},
api: {
read: 'e-read.php',
create: 'e-create.php',
destroy: 'e-destroy.php',
update: 'e-update.php'
},
writer : {
type : 'json',
root: 'data',
encode: true,
writeAllFields: true,
listful : true,
allowSingle: false
}
}
});
//var startDate = new Date(2012, 8, 10),
var startDate = new Date(),
endDate = Sch.util.Date.add(startDate, Sch.util.Date.WEEK, 2);
var scheduler = Ext.create('App.PHPScheduler', {
eventBarTextField : 'Name',
viewPreset : 'dayAndWeek',
startDate : startDate,
endDate : endDate,
title : 'Scheduler with pagination',
eventResizeHandles : 'both',
width : 1200,
height : 350,
renderTo : Ext.getBody(),
resourceStore : resourceStore,
eventStore : eventStore,
/* tbar : [{
xtype: 'button',
text : 'Add new resource',
border: 1,
handler : function() {
resourceStore.add(new resourceStore.model({
Name : 'New resource'
}));
//if next page was created, switch to it
if (resourceStore.getCount() > resourceStore.pageSize){
var current = resourceStore.currentPage;
resourceStore.loadPage(current+1);
}
},
scope: this
}],*/
//define bottom bar with pagination buttons
bbar : Ext.create('Ext.PagingToolbar', {
store : resourceStore,
displayInfo : true,
displayMsg : 'Displaying resources {0} - {1} of {2}',
emptyMsg : "No resources to display"
})
});
scheduler.on('eventcontextmenu', scheduler.onEventContextMenu, scheduler);
//load first page of our resources
resourceStore.loadPage(1);
}
};
But still it is not working. Please check once again.