View Full Version : Get reference to controller within model.load's success

16 Nov 2011, 7:24 AM
Given the following inside a controller method:
... etc

How would i call a controller method from within success? Outside of the load function this.method(); would work but obviously scoping issues here.

I found some old topics on Ext.createDelegate which i cant find in the docs anymore so I've assumed its gone. I've also tried the straight forward .createDelegate(this); at the end of model.load() this just makes a huge mess though saying that the entire block is undefined.

I'm continually running into scope issues like these and would love a way to get around them? Is my approach wrong? or is there a SUPER SECRET AWESOME :D way of getting a reference to the controller?

Thanks again :)

16 Nov 2011, 7:50 AM
method1: function() {
var me = this,
model = ...;

model.load(1, {
success:function(record) {
method2: function (...

16 Nov 2011, 9:51 AM
Oh...Thats awesome and simple at the same time :D