PDA

View Full Version : Error in TabPanel



nicosk
5 Dec 2011, 5:05 AM
i get this error in Firebug


c is not a constructor
this.instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+')');

Where it traces to my app.js file on line 9 where i create a tabPanel


var tabPanel = Ext.create('Ext.tab.Panel', {
region: 'center',
id: 'centerPanel',
items: [{
title: 'Center Panel',
autoScroll: true
}]
});

I've removed all the code from inside the panel but i still get the error. Any help will be appreciated.

Nicos

tobiu
5 Dec 2011, 5:21 AM
i do not see an error in this short sniplet.

you should get more familiar with debugging: include the debug version of ext js for development, use the chrome console or firebug and step through to see what is happening.

if you create custom classes with an initComponent method without calling the parent you get this error or more in general: whenever you try to use classes that do not exist (are not included,...).

nicosk
5 Dec 2011, 5:39 AM
Yeap, Google Chrome Console is giving me an error:


Uncaught TypeError: object is not a function
(anonymous function)
Ext.ClassManager.instantiateext-all-debug.js:3948
(anonymous function)ext-all-debug.js:1555
(anonymous function)

Which is on

var contactsStore = Ext.create('AM.store.Contacts');

and my store is:


Ext.define('AM.store.Contacts', {
extend: 'Ext.data.Store',
model: 'AM.model.Contact',
id: 'contactStore',
groupField: 'group',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'data/contacts.php'
},
reader: {
type: 'json',
root: 'contacts',
successProperty: 'success'
}
}
});

tobiu
5 Dec 2011, 5:46 AM
did you try:


console.log('AM.store.Contacts', AM.store.Contacts);
var contactsStore = Ext.create('AM.store.Contacts');

nicosk
5 Dec 2011, 5:56 AM
When i tried what you said i get:


AM.store.Contacts function () {
return this.constructor.apply(this, arguments);
}

PranKe01
21 Feb 2012, 12:44 AM
Same problem here :( Here is some code:


<div id="ChartDiv"></div><script language="javascript" type="text/javascript"> var appConfig = { appFolder: '/Scripts/Stp/Charts/app' };</script><script type="text/javascript" src="/Scripts/Stp/Charts/app.js"></script><script language="javascript" type="text/javascript"> Ext.onReady(function () { var Ext.create('StpCharts.store.ComparisonStore', { storeId: 'ComparisonStore'+11, autoLoad: true, proxy: { url: '/ApiRead', extraParams: { person: 1, state: 1, time: 4, type: 2, place: 1, placeList: [11]
},
type: 'ajax', noCache: false, reader: { type: 'json', root: 'data' } }, listeners: { load: function(store, records, successful, operation, eOpts){ if(successful && records.length > 0 && records[0].data.Amount > 0){
Ext.create('StpCharts.view.LineChart', {
id: 'lineChartCmp'+11,
store: 'ComparisonStore'+11,
renderTo: 'ChartDiv',
items: [{
type : 'text',
text : 'Test',
font : '14px Helvetica',
x : 80,
y : 10
}]
});
}else{
Ext.create('StpCharts.view.LineChart', { // Line 362: Here comes the error Ext.create.listeners.load
id: 'lineChartCmp'+11,
renderTo: 'ChartDiv',
height: 75,
items: [{
type : 'text',
text : 'N/A',
font : '18px Helvetica',
x : 80,
y : 25
}]
});
}
}
}
});
// some more stores and instantiations...

It looks for me that this error only appears, when more than 2-3 stores and charst are made!?

Here is the full error-log:

Uncaught TypeError: object is not a function(anonymous function)Ext.ClassManager.instantiateext-all-debug.js:3948(anonymous function)ext-all-debug.js:1555Ext.create.listeners.loadImVergleich:362fireext-all-debug.js:10658Ext.define.continueFireEventext-all-debug.js:13854Ext.define.fireEventext-all-debug.js:13834Ext.define.onProxyLoadext-all-debug.js:45299Ext.data.proxy.Server.override.processResponseExt.data.proxy.Server.js:33(anonymous function)ext-all-debug.js:26086Ext.apply.callbackext-all-debug.js:5283Ext.define.onCompleteext-all-debug.js:18241Ext.define.onStateChangeext-all-debug.js:18192(anonymous function)ext-all-debug.js:1537

Any hints whats going wrong?