catacaustic
23 Sep 2012, 3:16 PM
I'm trying to use refs in a controllers function and this is giving me an error when I'm trying to use the auto-generated getter functions for refs.
I'm calling this from a primary controller:
setUser: function (grid, td, cell, rec) {
this.getController ("Adminuser").setName (rec.get ("name"));
}, // setUser ()
This part works correctly, gets the name, and passes it off to the second controller.
Then inside my second controller I have:
refs: [
{
ref: "usersNameField",
selector: "adminuser tbtext[type=usersname]"
}
]
...
setName: function (name) {
console.log ("Controller setting name as '" + name + "'");
this.getUsersNameField ().setText (name);
}, // setName ()
The error that I get is:
TypeError: this.getUsersNameField() is undefined
I'm pretty sure that this is a scope issue, but I can't figure out where the error is coming from. Does anyone have an idea of where I'm going wrong?
I'm calling this from a primary controller:
setUser: function (grid, td, cell, rec) {
this.getController ("Adminuser").setName (rec.get ("name"));
}, // setUser ()
This part works correctly, gets the name, and passes it off to the second controller.
Then inside my second controller I have:
refs: [
{
ref: "usersNameField",
selector: "adminuser tbtext[type=usersname]"
}
]
...
setName: function (name) {
console.log ("Controller setting name as '" + name + "'");
this.getUsersNameField ().setText (name);
}, // setName ()
The error that I get is:
TypeError: this.getUsersNameField() is undefined
I'm pretty sure that this is a scope issue, but I can't figure out where the error is coming from. Does anyone have an idea of where I'm going wrong?