Reputation: 836
I have a portlet that includes a tabbed panel. In that panel is a chart. In one of the chart's functions, I do a console.log(this)
and am able to view all of the contents. However, my main intention is to use the value this.ownerCt
, this says that it exists, but when I try to use it, or console.log it, it reports as undefined. If I do a this.id
or this.idname
I get the actual ids.
Problem: Why would this.SOMETHING
return undefined
if there is a value for it in this
?
Some code tidbits:
here is console.log(this)
.
Ext.Class.newClass
additionalCls: Array[2]
body: Ext.Element.Ext.core.Element
childEls: Array[1]
collapseDirection: "top"
componentCls: "x-panel"
componentLayout: Ext.Class.newClass
componentLayoutCounter: 3
container: Ext.Element.Ext.core.Element
dockedItems: Ext.Class.newClass
el: Ext.Element.Ext.core.Element
id: "stackedbarportlet-1055"
itemId: "graph"
items: Ext.Class.newClass
ownerCt: Ext.Class.newClass
xtype: "stackedbarportlet"
I took a few instances out, but this is the general output of it!
console.log(this.ownerCt)
results in: undefined
.
Upvotes: 1
Views: 771
Reputation: 73
You may find your answer here. It seems that sometimes console.log()
invocations are queued and eventually invoked after the end of the current statement, so their output don't necessarily reflect the object state exactly in the moment as it is in the code.
At least, I experienced similar behavior when I was overriding the constructor function in custom defined ExtJS's store.
Upvotes: 0
Reputation: 1191
<script>
var t1="";
var t2;
if (t1===undefined)
{
alert("t1 is undefined");
}
if (t2===undefined)
{
alert("t2 is undefined");
}
</script>
if you run that t2 is undefined probably this.ownerCt has no value
Upvotes: 1