PDA

View Full Version : custom classes not working locally



kiran_e
18 Jan 2013, 8:23 AM
Hi,
I have created my own class it is extends from Panel. It is working fine in local host(wamp). When i am trying to load in locally. i am getting fallowing error in console.


//Error
"XMLHttpRequest cannot load file:///C:/wamp/www/kiran/sample1/MyButton.js?_dc=1358525577264. Cross origin requests are only supported for HTTP.
Uncaught TypeError: object is not a function index1.html:2"


// My custom class
Ext.define('MyButton',{


requires: [
'Ext.panel.Panel'
],
alternateClassName: 'MyButton',


extend:'Ext.panel.Panel',


title:'Hello',
initComponent: function() {
var me = this;

me.callParent(arguments);
}})

// iam creating in this way
Ext.onReady(function (){
var btn=Ext.create('MyButton',{id:'mybusstton',renderTo:Ext.getBody()})


})

skirtle
20 Jan 2013, 6:52 AM
By 'locally' do you mean directly off the file-system, without a webserver?

Have you got an Ext.require for it? I suspect it's trying to load it synchronously when you do the Ext.create.

Which ExtJS file are you using? If you're using one of the *-dev.js builds then you should be getting warnings and errors for this kind of problem.