Damn scoping, what am I missing??
Hi guys,
I'm testing some things and I thought that I fully understand scoping but I have a issue:
See the following code:
Code:
Ext.define("MyCompany.MyScheduler", {
extend : 'Sch.panel.SchedulerGrid',
tbar : [
{
xtype : 'buttongroup',
columns : 3,
title : Your menu,
items : [
{
iconCls : 'icon-prev',
handler : function() {
this.shiftPrevious();
}
},
{
text : 'Date',
menu : Ext.create('Ext.menu.DatePicker', {
handler : function(datePicker, pickedDate) {
var startDateTime = new Date(pickedDate);
startDateTime.clearTime();
startDateTime.setHours(5);
var endDateTime = startDateTime.clone();
endDateTime.setHours(21);
return schPanel.switchViewPreset('pnViewPreset', startDateTime, endDateTime);
}
})
},
{
iconCls : 'icon-next',
handler : function() {
this.shiftNext();
}
}
]
}
],
initComponent : function() {
Ext.apply(this, {
// Setup your static columns
columns : [
{ header : 'Header1', sortable: true, width: 150, dataIndex : 'Header1' },
{ header : 'Header2', sortable: true, width: 100, dataIndex : 'Header2 }
]
});
this.callParent(arguments);
}
});
the problem is
Quote:
this.shiftNext() AND this.shiftPrevious()
In both cases it is telling:
Quote:
Uncaught TypeError: Object [object Object] has no method 'shiftNext'
If I place the entire tbar code in:
Code:
Ext.apply(this, { // Setup your static columns
columns : [
{ header : 'Header1', sortable: true, width: 150, dataIndex : 'Header1' },
{ header : 'Header2', sortable: true, width: 100, dataIndex : 'Header2 }
]
});
this.callParent(arguments);
Then it is working, but this is a workaround, the real bug is me, i still do not understand it in this context...
This class is called from another JavaScript file like this:
Code:
var scheduler = Ext.create("MyCompany.MyScheduler", {
dndValidatorFn : this.validatorFn,
viewConfig : {stripeRows : false, forceFit: true}
})
:((