PDA

View Full Version : c is not a constructor



m400mail
28 Nov 2011, 5:20 AM
Hello to all,

i want to Display a simple Window by start the app.js.
here is my app.js

Ext.application({
name: 'APP02',
appFolder: 'app',
controllers: ['App02_controller'],


// Start function ( Beginn )
launch: function() {



Ext.create('App02.views.user.a_login_window').show();

}
});


the controller

//
Ext.define('APP02.controller.App02_controller', {
extend: 'Ext.app.Controller',
views: ['user.a_login_window' ],
//stores:['datastore_Users'],
//models:['Model_User'],


init: function() {

this.control({


'aLoginWindow': {
render: this.onPanelRendered
}

});
},
onPanelRendered: function() {
console.log('panel ist gerenderd');
},

});


and the view a_login_window

Ext.define('APP02.view.user.a_login_window', {
extend: 'Ext.window.Window',
alias : 'widget.aLoginWindow',
title : 'Login Window',
layout: 'fit',
autoShow: false,
initComponent: function() {
this.items = [
{
xtype: 'form',
items: [
{
xtype: 'textfield',
name : 'login_name',
fieldLabel: 'Login Account'
},
{
xtype: 'textfield',
name : 'login_password',
fieldLabel: 'Password'
}
]
}
];



this.buttons = [
{
id: 'BT_Save',
text: 'Save',
action: 'speichern'
},
{
text: 'Cancel',
scope: this,
handler: this.close
}
];
this.callParent(arguments);

}
});



After start the Firebug says
c is not a constructor
this.instantiators[len... 'return new c('+args.join(',')+')');

Whats wrong ????
michael

tobiu
28 Nov 2011, 5:36 AM
first, use ext-debug and the Ext.Loader to get detailled error messages.

for me it looks like the window class is not know at the point the app launches.
did you include it correctly?

you should do some logs before creating the window to see what exactly is happening.

m400mail
28 Nov 2011, 5:44 AM
sorry,

here are the index.html

<html>
<head>
<title>Application 02 Sample</title>
<link rel="stylesheet" type="text/css" href="EXT40/resources/css/ext-all.css">
<script type="text/javascript" src="EXT40/ext-all-debug.js"></script>
<script type="text/javascript">
// configure the dynamic class loader
Ext.Loader.setConfig({
enabled: true,
paths: {'APP02':'controller'}
});
</script>


<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>


How can i find more Errormessages ?

tobiu
28 Nov 2011, 6:04 AM
for development, it makes sense to switch ext-all-debug.js to ext-debug.js, since then you get single file includes for each ext js module and the error messages do not point to a huge single file.

paths: {'APP02':'controller'}

looks a bit strange to me.
do you follow the folder pattern ->
http://docs.sencha.com/ext-js/4-0/#!/guide/application_architecture

i still think the loader does not find your view. you can test it with just some console.logs.

m400mail
28 Nov 2011, 6:34 AM
Hello,

now i have changed the index.html to

<html>
<head>
<title>Application 02 Sample</title>
<link rel="stylesheet" type="text/css" href="EXT40/resources/css/ext-all.css">
<script type="text/javascript" src="EXT40/ext-debug.js"></script>
<script type="text/javascript">
// configure the dynamic class loader
Ext.Loader.setConfig({
enabled: true,
paths: {APP02:'controller'}
});
</script>


<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>


but now the firebug displays no messages

after this i have changed the app.js

Ext.application({
name: 'APP02',
appFolder: 'app',
controllers: ['App02_controller'],


// Start function ( Beginn )
launch: function() {

Ext.MessageBox.alert('Message Box', 'Programm gestartet.');
Ext.create('App02.views.user.a_login_window').show();

}
});


nothing happens.

After changed the index.html to

<html>
<head>
<title>Application 02 Sample</title>
<link rel="stylesheet" type="text/css" href="EXT40/resources/css/ext-all.css">
<script type="text/javascript" src="EXT40/ext-all-debug.js"></script>
<script type="text/javascript">
// configure the dynamic class loader
Ext.Loader.setConfig({
enabled: true,
paths: {APP02:'controller'}
});
</script>


<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>


the Browser displays only the Message box
and the
c is not a constructor
Message

redraid
29 Nov 2011, 4:05 AM
Remove
paths: {APP02:'controller'} from loader config,
rename
name: 'APP02' to
name: 'App02' in app config,
make sure that you folders like this:


app/
controller/
App02_controller.js
view/
user/
a_login_window.js
app.js

redraid
29 Nov 2011, 4:08 AM
You error:

Ext.create('App02.views.user.a_login_window').show(); // "views" - wrong namespace
Ext.create('App02.view.user.a_login_window').show(); // Correct

m400mail
29 Nov 2011, 7:18 AM
Hi,

very good

Thank's a lot

Michael

m400mail
29 Nov 2011, 7:20 AM
Hi, <BR><BR>very good<BR><BR>Thank's a lot<BR><BR>Michael