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.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.