博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ExtJS中layout的12种布局风格
阅读量:4157 次
发布时间:2019-05-26

本文共 5281 字,大约阅读时间需要 17 分钟。

extjs的容器组件都可以设置它的显示风格,它的有效值有 absolute, accordion, anchor, border, card, column, fit, form and table.  一共9种。

另外几种见:  http://www.sencha.com/deploy/dev/examples/layout-browser/layout-browser.html  里面有详细的例子。

 

·  absolute 顾名思义,在容器内部,根据指定的坐标定位显示 

This is a simple layout style that allows you to position items within a container using CSS-style absolute positioning via XY coordinates.

Sample Config:

layout: 'absolute',items:[{    title: 'Panel 1',    x: 50,    y: 50,    html: 'Positioned at x:50, y:50'}]

 

· accordion 这个是最容易记的,手风琴效果

Displays one panel at a time in a stacked layout. No special config properties are required other than the layout — all panels added to the container will be converted to accordion panels.

      hello-extjs        
This is my HTML page.

· anchor 这个效果具体还不知道有什么用,就是知道注意一下  
1.容器内的组件要么指定宽度,要么在anchor中同时指定高/宽,  

2.anchor值通常只能为负值(指非百分比值),正值没有意义,  
3.anchor必须为字符串值

Provides anchoring of contained items to the container's edges. This type of layout is most commonly seen within FormPanels (or any container with a FormLayout) where fields are sized relative to the container without hard-coding their dimensions.

In this example, panels are anchored for example purposes so that you can easily see the effect. If you resize the browser window, the anchored panels will automatically resize to maintain the same relative dimensions.

      hello-extjs        
This is my HTML page.

 

 

· border 将容器分为五个区域:east,south,west,north,center

This Layout Browser page is already a border layout, and this example shows a separate border layout nested within a region of the page's border layout. Border layouts can be nested with just about any level of complexity that you might need.

Every border layout must at least have a center region. All other regions are optional.

Sample Config:

layout:'border',defaults: {    collapsible: true,    split: true,    bodyStyle: 'padding:15px'},items: [{    title: 'Footer',    region: 'south',    height: 150,    minSize: 75,    maxSize: 250,    cmargins: '5 0 0 0'},{    title: 'Navigation',    region:'west',    margins: '5 0 0 0',    cmargins: '5 5 0 0',    width: 175,    minSize: 100,    maxSize: 250},{    title: 'Main Content',    collapsible: false,    region:'center',    margins: '5 0 0 0'}]

 

 

· card (TabPanel)

      hello-extjs        
This is my HTML page.

 

 · card (Wizard)

You can use a Card layout to create your own custom wizard-style screen. The layout is a standard CardLayout with a Toolbar at the bottom, and the developer must supply the navigation function that implements the wizard's business logic (see the code in basic.js for details).

Sample Config:

layout:'card',activeItem: 0, // index or idbbar: ['->', {    id: 'card-prev',    text: '« Previous'},{    id: 'card-next',    text: 'Next »'}],items: [{    id: 'card-0',    html: 'Step 1'},{    id: 'card-1',    html: 'Step 2'},{    id: 'card-2',    html: 'Step 3'}]

 

 
· column 把整个容器看成一列,然后向容器放入子元素时

This is a useful layout style when you need multiple columns that can have varying content height. Any fixed-width column widths are calculated first, then any percentage-width columns specified using the columnWidth config will be calculated based on remaining container width. Percentages should add up to 1 (100%) in order to fill the container.

Sample Config:

layout:'column',items: [{    title: 'Width = 25%',    columnWidth: .25,    html: 'Content'},{    title: 'Width = 75%',    columnWidth: .75,    html: 'Content'},{    title: 'Width = 250px',    width: 250,    html: 'Content'}]

 

· fit 一个子元素将充满整个容器(如果多个子元素则只有一个元素充满整个容器)

A very simple layout that simply fills the container with a single panel. This is usually the best default layout choice when you have no other specific layout requirements.

Sample Config:

layout:'fit',items: {    title: 'Fit Panel',    html: 'Content',    border: false}

 

·  form 是一种专门用于管理表单中输入字段的布局

      hello-extjs        
This is my HTML page.

 · table 按照普通表格的方法布局子元素,用layoutConfig:{columns:3},//将父容器分成3列

      hello-extjs        
This is my HTML page.

VBox

A layout that allows for the vertical and horizontal stretching of child items, much like the container layout with size management.

Sample Config:

layout: {    type: 'vbox'    align : 'stretch',    pack  : 'start',},items: [    {html:'panel 1', flex:1},    {html:'panel 2', height:150},    {html:'panel 3', flex:2}]

 

HBox

A layout that allows for the vertical and horizontal stretching of child items, much like the column layout but can stretch items vertically.

Sample Config:

layout: {    type: 'hbox',    pack: 'start',    align: 'stretch'},items: [    {html:'panel 1', flex:1},    {html:'panel 2', width:150},    {html:'panel 3', flex:2}]

分类: 

转载地址:http://ybyxi.baihongyu.com/

你可能感兴趣的文章
sprintf函数的说明
查看>>
BOOST_TYPEOF和BOOST_AUTO 作用
查看>>
随机森林概述
查看>>
2011十大战略技术
查看>>
大学应该学的软件知识
查看>>
腾讯与360战争背后的云计算阴影
查看>>
腾讯看了会沉默,360看了会流泪
查看>>
李开复:移动互联网机会最大 微博会现最大赢家
查看>>
2006年的IT十大战略技术
查看>>
操作系统介绍
查看>>
Desktop Linux: The Dream Is Dead
查看>>
我的9年IT路
查看>>
任正非:让用户像用电一样享受云计算
查看>>
学习技术的几个境界
查看>>
计算机世界:免费的代价
查看>>
方兴东:中国网站十年
查看>>
2010年微软和谷歌十大战场:从桌面到浏览器
查看>>
马云给阿里巴巴员工的公开信
查看>>
服务器虚拟化的未来之路
查看>>
写给我们这些浮躁的系统工程师
查看>>