- Ext.js - Home
- Ext.js - Overview
- Ext.js - Environment Setup
- Ext.js - Naming Convention
- Ext.js - Architecture
- Ext.js - First Program
- Ext.js - Class System
- Ext.js - Containers
- Ext.js - Layouts
- Ext.js - Components
- Ext.js - Drag & Drop
- Ext.js - Themes
- Ext.js - Custom Events and Listeners
- Ext.js - Data
- Ext.js - Fonts
- Ext.js - Style
- Ext.js - Drawing
- Ext.js - Localization
- Ext.js - Accessibility
- Ext.js - Debugging Code
- Ext.js - Methods
Ext.js - Container Inside Container
Container inside container: We can have containers inside other containers as a component for the parent container along with other components.
Syntax
Following is the simple syntax to use Container inside the container.
var container = Ext.create('Ext.container.Container', {
items: [component3, component4]
});
Ext.create('Ext.container.Container', {
renderTo: Ext.getBody(),
items: [container]
});
You can have a container as an item inside the other container.
Example
Following is a simple example showing a container inside a 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'
});
var component4 = Ext.create('Ext.Component', {
html: 'Fourth Component'
});
var container = Ext.create('Ext.container.Container', {
style: {borderStyle: 'solid', borderWidth: '2px' },
width: '50%',
items: [component3, component4]
});
Ext.create('Ext.container.Container', {
renderTo: Ext.getBody(),
title: 'Container',
border: 1,
width: '50%',
style: {borderStyle: 'solid', borderWidth: '2px' },
items: [component1, component2, container]
});
});
</script>
</head>
<body>
</body>
</html>
The above program will produce the following result −
extjs_containers.htm
Advertisements