PDA

View Full Version : access variable from a function



m.tzagkarakis
7 Sep 2015, 6:48 AM
This is probably a silly question but I can not figure the answer.
Let's say I am defining a column for a grid in initComponent function



...
this.columns = [{
text: 'Name',
customVariable: "Something"
listeners: {
'focus' : function(comp, evObj, opts){
//access custom variable here
}
}
}]
...


Can do I have access to customVariable from inside the listener's function?
comp.customVariable does not work and this.customVariable is refering to panel's scope.

jdkhamba
8 Sep 2015, 6:15 PM
Seems like the customVariable is defined on the column config. So, comp.columns[0].customVariable should work. Although, I am curious, how exactly is the 'focus' on the column getting fired? Also, why exactly would you need to access a varialble in such a way?

m.tzagkarakis
9 Sep 2015, 7:02 AM
I needed to define a Ext.tip.ToolTip as a column variable in order to manually show when cell was on focus.