- Ext JS 3.0 Cookbook
- Jorge Ramon
- 344字
- 2021-04-01 13:43:48
Using the table layout
If you have remained faithful to HTML tables, then you are in luck! Ext JS provides a layout manager—TableLayout
—whose basic building concept is conceptually similar to building an HTML table.
This is how you can create a complex table layout with cells that span multiple rows or columns. In the following screenshot, you'll see what the end result looks like:

How to do it...
- The table cells are built as follows:
c1={ title: 'A cell', html: '<p>colspan=1<br/>rowspan=1</p>' } // This cell spans 2 columns. c2={ title: 'A cell', html: '<p>colspan=2<br/>rowspan=1</p>', colspan: 2 } // This cell spans 3 rows. c3={ title: 'A cell', html: '<p>colspan=1<br/>.<br/>.<br/>.<br/>. <br/>.<br/>.<br/>.<br/>.<br/>.<br/>rowspan=3</p>', rowspan: 3 } c4={ title: 'A cell', html: '<p>rowspan=3<p>' } // This cell spans 2 rows. c5={ title: 'A cell', html: 'colspan=1<br/>.<br/>.<br/>.<br/> rowspan=2</p>', rowspan: 2 } c6={ title: 'A cell', html: '<p>colspan=4<p>' } c7={ title: 'A cell', html: '<p>colspan=4<p>' } // This cell does not have the panel header. c8={ html: 'Plain cell' }
- The cells are added to their container. Notice the
layout:'table'
configuration option:var container=new Ext.Viewport({ layout: 'table', defaults: { bodyStyle: 'padding:10px' }, layoutConfig: { columns: 4 }, items: [c1,c2,c3,c4,c5,c6,c7,c8] });
The code starts by creating the table cells, which are panel components. Note how you can use the colspan
and rowspan
configuration options of each cell to build a layout as complex as you need.
These cells are added to their container, which uses a table layout specified through the layout
configuration option. Additionally, the number of columns is passed via the layoutConfig
object.
TableLayout
is useful when you need a rich, grid-like structure for your components. This layout figures out how to position each panel within the table based on the column count, rowspans
, and colspans
. Be mindful that, as with the HTML tables, rowspans
and colspans
should add up correctly in the overall layout.
- User Training for Busy Programmers
- Photoshop圖形圖像設計案例教程(高等院校計算機任務驅動教改教材)
- AutoCAD快速自學寶典(2018中文版)
- 3ds Max/VRay室內設計材質、燈光與建模速查超級手冊
- 3ds max & VRay產品造型設計經典
- Premiere Pro 2022從新手到高手
- Google App Engine Java and GWT Application Development
- 新編 中文版Photoshop平面設計入門與提高
- 蝶變:移動用戶體驗設計之道
- WordPress MU 2.8: Beginner's Guide
- Adobe Flash 11 Stage3D (Molehill) Game Programming Beginner's Guide
- SolidWorks 2017基礎與實例教程
- Photoshop CS6淘寶美工完全實例教程(培訓教材版)
- Revit建模進階標準教程(實戰微課版)
- Photoshop CG 古風插畫繪制技法精解