PDA

View Full Version : Dividing code , rather than writing it all inline



adibhagra
14 Oct 2009, 9:08 AM
hey guys,

i have been writing all my code inline within a single page, whether it be grids or accordions or anything, now i want to write code such that my grid is another page and accordions in another and then access them in one page. how do i achieve this, i 'd appreciate an example

regards

ice

Jack9
14 Oct 2009, 10:05 AM
<script type="text/javascript" src="/js/ext1.js"></script>
<script type="text/javascript" src="/js/ext2.js"></script>
<script type="text/javascript" src="/js/ext3.js"></script>

ExtJS is valid javascript. You can specify


Ext.onReady(function(){
alert("test");
});

in multiple pages.

Your big issue is making sure everything is instantiated/created before you start a script that attempts to coordinate behaviors. Might want to delay adding listeners until you are in the last script, i.e.

myPanel.on('render',function(){...});

adibhagra
14 Oct 2009, 10:28 AM
thanks a lot man