PDA

View Full Version : Problem getting UpdateManager callback called



brian.moeskau
6 Jan 2007, 10:42 AM
I have these methods as part of a larger class that is otherwise working well (other code clipped for brevity):


getDay : function(e, dtOffset) {
updateMgr.update({
url: 'yui-ext.aspx',
callback: this.getDayCB,
params: { action: 'getDay', date: currDate.dateFormat("Y/m/d") }
});
},

getDayCB : function(el, success, resp) {
if (success){
msg.update('Done');
}
else {
msg.update('Error');
}
},


The callback getDayCB gets called correctly only once on page load (the first time I call getDay), but when I am making async requests from the page to render different days by calling getDay, the callback param is always undefined when I inspect it inside of the UpdateManager.update() method -- all other params come across normally. Seems like a scope issue, but I'm not seeing it. What am I missing?

jack.slocum
6 Jan 2007, 3:44 PM
getDay : function(e, dtOffset) {
updateMgr.update({
url: 'yui-ext.aspx',
callback: this.getDayCB,
params: { action: 'getDay', date: currDate.dateFormat("Y/m/d") },
scope: this
});
}