PDA

View Full Version : Problem with path and loader



JoelB
8 Jun 2012, 12:35 AM
Hi,


I get a wierd error that has something to do with the loader and the pahts.
I have loaded the page and Ext-all. Then I define the component ExtPage, which in turn inherits from a custom extension of lets say Panel. The path is set up correctl so that Ext finds Own.panel.Panel. Heres the code and the output:




Ext.define('ExtPage', {
extend: 'Own.panel.Panel'
});

Output:


function constructor() {


return this.constructor.apply(this, arguments) || null;
}

so I write:


Ext.create('ExtPage');

and get the error in chrome:
GET http://localhost/wi4client/src/ExtPage.js?_dc=1339143965680 404 (Not Found) ext-all-debug.js:5635
constructor


But next time I write it:


Ext.create('ExtPage');



It succeeds???!


constructor


So what can I do to make sure all is loaded? I cannot give ExtPanel a name that corresponds to a path since it is a generated class and has no path.


Please help me.
Cheers,
//J

JoelB
8 Jun 2012, 8:00 AM
Please smart people! If I am making no sense or supplying the wrong info, please let me know.
//J

mattea
8 Jun 2012, 10:24 AM
I am not sure exactly what you're writing, but are you doing this in an Ext.onReady block? E.g.:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.io/ext-4.1.0-gpl/resources/css/ext-all.css">
<script type="text/javascript" charset="utf-8" src="http://cdn.sencha.io/ext-4.1.0-gpl/ext-all.js"></script>
<script type="text/javascript">
Ext.require(['Ext.data.*', 'Ext.grid.*']);
Ext.define('ExtPage', {
extend: 'Ext.panel.Panel',
height: 200,
width: 400,
title: 'ExtPage'
});
Ext.onReady(function() {
Ext.create('ExtPage', {
renderTo: Ext.getBody()
});
});
</script>
</head>
<body>
</body>
</html>

scottmartin
8 Jun 2012, 10:48 AM
Please be more specific or provide a better example if post #3 did not resolved your problem.

Scott.

JoelB
8 Jun 2012, 11:56 AM
Ext.onReady works fine but does create some issues with asyncronicity in functions where I dont want it ;). Oh well, thank you for the good answer at least.

But I have to say I think that its weird that defining a class is an async action.

Cheers,
//J