1

Within Ext JS 4, I need to load D3 API. I am using the below code

loadScript: function(callback, scope) {	console.log('5) loadScript called');	Ext.Loader.injectScriptElement('http://d3js.org/d3.v3.js', onLoad, onError); console.log('D3 script loaded '); }, onError : function() {	console.log('On Error');	},	onLoad : function() {	console.log('On Load');	d3.select('body').append('div').style('position', 'absolute').style('padding', '0 10px').style('background', 'red').style('opacity', 0);	},

However, in browser console, I get the below error -

Uncaught ReferenceError: onLoad is not defined

Can someone please help me rectify the above code?

Thank you.

1 Answer 1

2

Use this.onLoad and this.onError, like this:

Ext.Loader.injectScriptElement('http://d3js.org/d3.v3.js', this.onLoad, this.onError, this); 

(You can pass the scope too)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.