- 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.
- Moodle 2.0 E/Learning Course Development
- PrestaShop 1.3 Theming – Beginner’s Guide
- Dreamweaver基礎與實戰教程
- Python Text Processing with NLTK 2.0 Cookbook: LITE
- 中文版CorelDRAW X8基礎培訓教程(全彩版)
- Illustrator 2024從入門到精通
- After Effects影視特效立體化教程:After Effects 2021(微課版)
- NetLogo多主體建模入門
- Photoshop+Illustrator商業廣告設計從入門到精通(第2版)
- SPSS統計分析
- UG NX 12.0完全自學寶典
- 中文版Photoshop CS6應用技法教程
- Choosing an Open Source CMS: Beginner's Guide
- Getting Started with Oracle BPM Suite 11gR1 – A Hands/On Tutorial
- 中文版CINEMA 4D R20 實用教程