In this guide, we will discuss Components Inside container in Ext.js . Components inside container: We can have multiple components inside the container.
Syntax
Following is the simple syntax to use Components inside the container.
var component1 = Ext.create('Ext.Component', { html:'First Component' }); Ext.create('Ext.container.Container', { renderTo: Ext.getBody(), items: [component1] });
You can have components as an item inside a container.
Example
Following is a simple example showing the components inside the container.
<!DOCTYPE html> <html> <head> <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script> <script type = "text/javascript"> Ext.onReady(function () { var component1 = Ext.create('Ext.Component', { html:'First Component' }); var component2 = Ext.create('Ext.Component', { html: 'Second Component' }); var component3 = Ext.create('Ext.Component', { html: 'Third Component' }); Ext.create('Ext.container.Container', { renderTo: Ext.getBody(), title: 'Container', border: 1, width: '50%', style: {borderStyle: 'solid', borderWidth: '2px' }, items: [component1, component2, component3] }); }); </script> </head> <body> </body> </html>
Next Topic : Click Here
Pingback: Ext.js - Containers | Adglob Infosystem Pvt Ltd
Pingback: Ext.js - Ext.container.Viewport Container | Adglob Infosystem Pvt Ltd