PDA

View Full Version : code problem



hacpro
13 Sep 2007, 3:06 AM
hello..

i tried a tutorial from the web.. and it dosent works correctly..

====================the code - js part ================================
//URL of the tutorial http://dynamicinternet.eu/blog/2007-04-30/borderlayouts-mit-der-ext-library-teil-1/

var myLayout = new Ext.BorderLayout(document.body,{
north: {
split: true,
initialSize: 100
},
south: {
split: true,
initialSize: 100
},
east: {
split: true,
initialSize: 150
},
west: {
split: true,
initialSize: 150
},
center: {
}
});


myLayout.beginUpdate();
myLayout.add('north', new Ext.ContentPanel('oben', {
fitToFrame: true, closable: false
}));
myLayout.add('south', new Ext.ContentPanel('unten', {
fitToFrame: true, closable: false
}));
myLayout.add('east', new Ext.ContentPanel('rechts', {
fitToFrame: true, closable: false
}));
myLayout.add('west', new Ext.ContentPanel('links', {
fitToFrame: true, closable: false
}));
myLayout.add('center', new Ext.ContentPanel('mitte', {
fitToFrame: true
}));
myLayout.endUpdate();
===================================================================
======================html part======================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Layouts mit der Ext Library Document</title>
<link rel="stylesheet" type="text/css" href="../ext-1.1.1/resources/css/ext-all.css" />
<script type="text/javascript" src="../ext-1.1.1/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="../ext-1.1.1/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../ext-1.1.1/ext-all.js"></script>
<script type="text/javascript" src="dialog.js"></script>


<style type="text/css">
#oben{background: red;}
#unten{background: blue;}
#rechts{background: green;}
#links{background: yellow;}
#mitte{background: white;}
</style>

</head>
<body>
<div id="oben"></div>
<div id="unten"></div>
<div id="rechts"></div>
<div id="links"></div>
<div id="mitte"></div>

</body>
</html>
====================================================================

When i load the html page its simply empty.. but it shoudn't..

steffenk
13 Sep 2007, 3:08 AM
1) please use the codeboxes
2) You should read the tutorial from the beginning, you need to apply this with Ext.onready

Animal
13 Sep 2007, 3:09 AM
Run it in Firefox with Firebug enabled.

Check the console.

I bet the URLs for the .js and .css files are wrong.

Animal
13 Sep 2007, 3:10 AM
And as Steffen pointed out, you need to wait until the document has been rendered before you start building widgets using elements of that document.

hacpro
13 Sep 2007, 4:11 AM
and sorry for not using the codebox :D