PDA

View Full Version : Problem include ext files



aldev.web
21 Jun 2007, 7:02 AM
Hello,
I want to test ext-js with tutorials on the web site but when i try i have this error in firebug :

Ext is not defined
[Break on this error] var mainLayout = new Ext.BorderLayout(document.body, for layout example.

Path in my file is correct :

<script type="text/javascript" src='ext-1.0.1/ext-all.js'></script>

Do i add more include files? can you help me?

tryanDLS
21 Jun 2007, 7:09 AM
You are missing the adapter files. Please review the include_order.txt file from the download or look at the html files in the tutorials which include the files.

aldev.web
21 Jun 2007, 7:17 AM
When i'm including all files from include_order.txt, i have this error in firebug :

this.el has no properties
[Break on this error] Ext.ContentPanel=function(el,_2,_3){Ext.ContentPanel.superclass.constructor.call...

tryanDLS
21 Jun 2007, 7:21 AM
'All files'?? Please post the head section of your HTML page in 'CODE' tags.

aldev.web
21 Jun 2007, 7:25 AM
<head>
<script type="text/javascript" src="ext-1.0.1/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="ext-1.0.1/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src='ext-1.0.1/ext-all.js'></script>

<script language="JavaScript" type="text/javascript">
var mainLayout = new Ext.BorderLayout(document.body,
{
north: {
split: true, initialSize: 50
},
south: {
split: true, initialSize: 50
},
east: {
split: true, initialSize: 100
},
west: {
split: true, initialSize: 100
},
center: {
}
});
mainLayout.beginUpdate();
mainLayout.add('north', new Ext.ContentPanel('north-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('south', new Ext.ContentPanel('south-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('east', new Ext.ContentPanel('east-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('west', new Ext.ContentPanel('west-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('center', new Ext.ContentPanel('center-div', {
fitToFrame: true
}));
mainLayout.endUpdate();
</script>
</head>

aldev.web
21 Jun 2007, 10:56 PM
is it correct?

aldev.web
22 Jun 2007, 12:11 AM
Error in firebug :


this.el has no properties
LayoutManager(null, Object north=Object south=Object east=Object west=Object)ext-all.js (line 209)
BorderLayout(null, Object north=Object south=Object east=Object west=Object)ext-all.js (line 211)
[Break on this error] Ext.LayoutManager=function(_1,_2){Ext.LayoutManager.superclass.constructor.call(...
ext-all.js (line 209)


Can you help me?

evant
22 Jun 2007, 12:22 AM
The problem is because you're trying to run the code before the DOM is fully loaded. Try wrapping your code in an onready, like so:



<script language="JavaScript" type="text/javascript">
Ext.onReady(function()
{
var mainLayout = new Ext.BorderLayout(document.body,
{
north: {
split: true, initialSize: 50
},
south: {
split: true, initialSize: 50
},
east: {
split: true, initialSize: 100
},
west: {
split: true, initialSize: 100
},
center: {
}
});
mainLayout.beginUpdate();
mainLayout.add('north', new Ext.ContentPanel('north-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('south', new Ext.ContentPanel('south-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('east', new Ext.ContentPanel('east-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('west', new Ext.ContentPanel('west-div', {
fitToFrame: true, closable: false
}));
mainLayout.add('center', new Ext.ContentPanel('center-div', {
fitToFrame: true
}));
mainLayout.endUpdate();
}
);
</script>

aldev.web
22 Jun 2007, 12:32 AM
When i tested your code :

this.el has no properties
ContentPanel()ext-all.js (line 223)
BasicLayoutRegion(Object closable=false loaded=false active=false)ext-all.js (line 213)
LayoutRegion(Object closable=false loaded=false active=false)ext-all.js (line 215)
BorderLayout("north", Object closable=false loaded=false active=false)ext-all.js (line 211)
(no name)()ext_menu.php (line 37)
Observable()ext-all.js (line 15)
EventManager()ext-all.js (line 17)
[Break on this error] Ext.ContentPanel=function(el,_2,_3){Ext.ContentPanel.superclass.constructor.call...
ext-all.js (line 223)

evant
22 Jun 2007, 12:33 AM
Do you actually have divs in your page with the id:
'north-div'
'west-div'
etc?

aldev.web
22 Jun 2007, 12:47 AM
I'm sorry, i forgot the id, i changed the files many time for finding the solution...

Thanks a lot for your help !!:)