Mega Code Archive

 
Categories / JavaScript DHTML / Ext JS
 

Dynamically add item to a window

<html> <head> <title>Hello World Window</title> <link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" /> <script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-3.0.0/ext-all.js"></script> </head> <body> <script type="text/javascript"> Ext.onReady(function() {     var myWin = new Ext.Window({        height     : 300,        width      : 300,        title      : 'A window with a container layout',        autoScroll : true,        items      : [],        tbar : [           {              text    : 'Add child',              handler : function() {                 var numItems = myWin.items.getCount() + 1;                 myWin.add({                    title       : 'Child number ' + numItems,                    height      : 60,                    frame       : true,                    collapsible : true,                    collapsed   : true,                    html        : 'asdf'                 });                 myWin.doLayout();              }           }        ]     });          myWin.show(); }); </script>  <div id='div1'>asdf</div> </body> </html>