PDA

View Full Version : Question about this.callParent.caller returning null



havardge
15 Dec 2015, 6:17 AM
Hi,

I have an app (ext.js 4.2) that is composed of several js-files (a, b, c, ...), concatenated in a specific order; concat(a, b, c, ...). And this works nicely.

Now, to enable more rapid development I'd like to serve a, b, c, ... separately like such in the header:

<script src="a"/>
<script src="b"/>
<script src="c"/>
...

Note: ext.js is always included prior to my own files.

However, using separate serving I get a problem when calling this.callParent from inside a custom subclass. Because this call goes to this code block:


callParent: function(args) {
var method;

return (method = this.callParent.caller) && (method.$previous ||
((method = method.$owner ? method : method.caller) &&
method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
},


and when my files are not concatenated this.callParent.caller is always null. But when my files are concatenated, this.callParent.caller will correctly reference the function from which it was called. Typically at the end of a components initComponent method.

Can anyone help me with this?

Let me know if I need to clarify things.

Thanks in advance!

jdkhamba
15 Dec 2015, 3:13 PM
There is no need to load the various files using script tag if you are creating a single page application with the recommended folder structure mentioned here:

http://docs.sencha.com/extjs/4.2.0/#!/guide/application_architecture

All you need to do is mention in your application class the files that are required like this :


requires:['Fiddle.view.*']

Take a look at this example:

https://fiddle.sencha.com/#fiddle/12l6

Both the required files are loaded dynamically by ExtJS. no <script> tag needed.