9 March 2011

why my first application doesn't work in Extjs?

Quite often you copied and pasted first example called "Hello World" and ....it doesn't work and you wondering ...
WHY?
AM I STUPID?
IS THIS EXAMPLE IS CRAP OR EVEN LANGUAGE/FRAMWORK IS CRAP??

the answer is ... every language/framework needs some default settings to be applied to be damn sure that everything works correctly.
So what you need for extjs ?
  1. You need provide location for ext script 
  2. You need provice location for ext css
  3. You need create place where ext can be rendered
  4. You usually need      Ext.onReady(function(){ (Bla bla bla)  }
  5. Make sure that your javascript is turn on in your browser.
  6. Use firebug or opera dragonfly, they will explain(or usually write nonsense message) what went wrong with your code 


 Below  you example of "Hello world" in Extjs


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>ExtJS test zone.</title>
<link rel="stylesheet" type="text/css" href="lib/extjs/resources/css/ext-all.css" /> <!-- you need provide path to ext's css -->
<script src="lib/extjs/adapter/ext/ext-base.js"></script> <!-- you need provide path to ext's base -->
<script src="lib/extjs/ext-all.js"></script> <!-- you need provide path to ext's main extjs javascript file -->


<script type="text/javascript"> //each script should start from this tag with type specified

Ext.onReady(function(){

Ext.MessageBox.alert('This is my title', 'Hello world'); // each script should start from this tag with type specified

});


</script> <!-- each script should has end tag -->
</head>

<body>

</body>

</html>


This should solve 99% of your problems  :)
Good luck and enjoy view of most famous example in software developing :)