标签:
border布局:标准的上下左右中布局方式
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { width: 400, height: 400, renderTo: Ext.getBody(), layout: "border", items: [{ region: "west", title: ‘west‘, width:100 }, { region: "east", title: ‘east‘, width:100 }, { region: "north", title: ‘north‘ }, { region: "center", title: ‘center‘ }, { region: "south", title: "south" } ] }); });
accordion:手风琴
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { width: 400, height: 400, renderTo: Ext.getBody(), layout: "accordion", items: [{ title: "a", html: "a" }, { title: "b", html: "b" }, { title: "c", html: "c" }] }); });
card:向导,向导需要一个事件进行翻页,这里用了两个容器组装为一个容器进行展示
Ext.onReady(function() { var card = Ext.create(‘Ext.container.Container‘, { width: 400, height: 400, layout: "card", items: [{ html: ‘<h1>第一步</h1>‘ }, { html: ‘<h1>第二步</h1>‘ }, { html: ‘<h1>最后一步</h1>‘ }] }); var button = Ext.create(‘Ext.container.Container‘, { width: 400, height: 400, items: [{ html: ‘<h1>上一步</h1>‘, listeners: { click: { element: ‘el‘, fn: function() { card.getLayout()[‘prev‘](); } } } }, { html: ‘<h1>下一步<h1>‘, listeners: { click: { element: ‘el‘, fn: function() { card.getLayout()[‘next‘](); } } } }] }); Ext.create(‘Ext.container.Container‘, { renderTo: Ext.getBody(), items: [card, button] }) });
fit:平铺,此处有大坑
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { width:111, layout: "fit", items: [{ width:100, height:100, html: ‘<h1>第一步</h1>‘ }, { html: ‘<h1>第二步</h1>‘ }, { html: ‘<h1>最后一步</h1>‘ }], renderTo: Ext.getBody(), }); });
anchor:` 栅格`系统
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { layout: ‘anchor‘, items: [{ html: ‘<h1>第一步</h1>‘, anchor: ‘50% 50%‘ }, { html: ‘<h1>第二步</h1>‘, anchor: ‘75% 75%‘ }, { html: ‘<h1>最后一步</h1>‘ }], renderTo: Ext.getBody(), }); });
absolute:绝对布局
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { layout: ‘absolute‘, items: [{ x: 10, y: 10, html: ‘<h1>第一步</h1>‘ }, { x: 20, y: 20, html: ‘<h1>第二步</h1>‘ }, { x: 30, y: 30, html: ‘<h1>最后一步</h1>‘ }], renderTo: Ext.getBody(), }); });
column:列布局
Ext.onReady(function() { Ext.create(‘Ext.container.Container‘, { layout: ‘column‘, items: [{ columnWidth: .33, html: ‘<h1>第一步</h1>‘ }, { columnWidth: .33, html: ‘<h1>第二步</h1>‘ }, { columnWidth: .33, html: ‘<h1>最后一步</h1>‘ }], renderTo: Ext.getBody(), }); });
1.全部基于Ext.container.Container进行布局
2.大多数时候只要修改layout属性就可以得到想要的布局
3.每种布局都可能有专属的属性进行控制
Ext.container.Containe
标签:
原文地址:http://www.cnblogs.com/liuCy/p/4961731.html