You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

426 lines
16 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>ExtJS Layout Examples</title>
  5. <!-- ** CSS ** -->
  6. <!-- base library -->
  7. <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
  8. <!-- overrides to base library -->
  9. <link rel="stylesheet" type="text/css" href="../ux/css/CenterLayout.css" />
  10. <!-- page specific -->
  11. <link rel="stylesheet" type="text/css" href="layout-browser.css">
  12. <!-- ** Javascript ** -->
  13. <!-- ExtJS library: base/adapter -->
  14. <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
  15. <!-- ExtJS library: all widgets -->
  16. <script type="text/javascript" src="../../ext-all.js"></script>
  17. <!-- overrides to base library -->
  18. <!-- extensions -->
  19. <script type="text/javascript" src="../ux/CenterLayout.js"></script>
  20. <script type="text/javascript" src="../ux/RowLayout.js"></script>
  21. <!-- page specific -->
  22. <script type="text/javascript" src="layouts/basic.js"></script>
  23. <script type="text/javascript" src="layouts/custom.js"></script>
  24. <script type="text/javascript" src="layouts/combination.js"></script>
  25. <script type="text/javascript" src="layout-browser.js"></script>
  26. </head>
  27. <body>
  28. <div id="header"><h1>Ext Layout Browser</h1></div>
  29. <div style="display:none;">
  30. <!-- Start page content -->
  31. <div id="start-div">
  32. <div style="float:left;" ><img src="images/layout-icon.gif" /></div>
  33. <div style="margin-left:100px;">
  34. <h2>Welcome!</h2>
  35. <p>There are many sample layouts to choose from that should give you a good head start in building your own
  36. application layout. Just like the combination examples, you can mix and match most layouts as
  37. needed, so don't be afraid to experiment!</p>
  38. <p>Select a layout from the tree to the left to begin.</p>
  39. </div>
  40. </div>
  41. <!-- Basic layouts -->
  42. <div id="absolute-details">
  43. <h2>Ext.layout.AbsoluteLayout</h2>
  44. <p>This is a simple layout style that allows you to position items within a container using
  45. CSS-style absolute positioning via XY coordinates.</p>
  46. <p><b>Sample Config:</b></p>
  47. <pre><code>
  48. layout: 'absolute',
  49. items:[{
  50. title: 'Panel 1',
  51. x: 50,
  52. y: 50,
  53. html: 'Positioned at x:50, y:50'
  54. }]
  55. </code></pre>
  56. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.AbsoluteLayout" target="_blank">API Reference</a></p>
  57. </div>
  58. <div id="accordion-details">
  59. <h2>Ext.layout.Accordion</h2>
  60. <p>Displays one panel at a time in a stacked layout. No special config properties are required other
  61. than the layout &mdash; all panels added to the container will be converted to accordion panels.</p>
  62. <p><b>Sample Config:</b></p>
  63. <pre><code>
  64. layout: 'accordion',
  65. items:[{
  66. title: 'Panel 1',
  67. html: 'Content'
  68. },{
  69. title: 'Panel 2',
  70. id: 'panel2',
  71. html: 'Content'
  72. }]
  73. </code></pre>
  74. <p>You can easily customize individual accordion panels by adding styles scoped to the panel by class or id.
  75. For example, to style the panel with id 'panel2' above you could add rules like this:</p>
  76. <pre><code>
  77. #panel2 .x-panel-body {
  78. background:#ffe;
  79. color:#15428B;
  80. }
  81. #panel2 .x-panel-header-text {
  82. color:#555;
  83. }
  84. </code></pre>
  85. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.Accordion" target="_blank">API Reference</a></p>
  86. </div>
  87. <div id="anchor-details">
  88. <h2>Ext.layout.AnchorLayout</h2>
  89. <p>Provides anchoring of contained items to the container's edges. This type of layout is most commonly
  90. seen within FormPanels (or any container with a FormLayout) where fields are sized relative to the
  91. container without hard-coding their dimensions.</p>
  92. <p>In this example, panels are anchored for example purposes so that you can easily see the effect.
  93. If you resize the browser window, the anchored panels will automatically resize to maintain the
  94. same relative dimensions.</p>
  95. <p><b>Sample Config:</b></p>
  96. <pre><code>
  97. layout: 'anchor',
  98. items: [{
  99. title: 'Panel 1',
  100. height: 100,
  101. anchor: '50%'
  102. },{
  103. title: 'Panel 2',
  104. height: 100,
  105. anchor: '-100'
  106. },{
  107. title: 'Panel 3',
  108. anchor: '-10, -262'
  109. }]
  110. </code></pre>
  111. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.AnchorLayout" target="_blank">API Reference</a></p>
  112. </div>
  113. <div id="border-details">
  114. <h2>Ext.layout.BorderLayout</h2>
  115. <p>This Layout Browser page is already a border layout, and this example shows a separate border layout
  116. nested within a region of the page's border layout. Border layouts can be nested with just about any
  117. level of complexity that you might need.</p>
  118. <p>Every border layout <b>must</b> at least have a center region. All other regions are optional.</p>
  119. <p><b>Sample Config:</b></p>
  120. <pre><code>
  121. layout:'border',
  122. defaults: {
  123. collapsible: true,
  124. split: true,
  125. bodyStyle: 'padding:15px'
  126. },
  127. items: [{
  128. title: 'Footer',
  129. region: 'south',
  130. height: 150,
  131. minSize: 75,
  132. maxSize: 250,
  133. cmargins: '5 0 0 0'
  134. },{
  135. title: 'Navigation',
  136. region:'west',
  137. margins: '5 0 0 0',
  138. cmargins: '5 5 0 0',
  139. width: 175,
  140. minSize: 100,
  141. maxSize: 250
  142. },{
  143. title: 'Main Content',
  144. collapsible: false,
  145. region:'center',
  146. margins: '5 0 0 0'
  147. }]
  148. </code></pre>
  149. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.BorderLayout" target="_blank">API Reference</a></p>
  150. </div>
  151. <div id="card-tabs-details">
  152. <h2>Ext.layout.CardLayout (TabPanel)</h2>
  153. <p>The TabPanel component is an excellent example of a sophisticated card layout. Each tab is just
  154. a panel managed by the card layout such that only one is visible at a time. In this case, configuration
  155. is simple since we aren't actually building a card layout from scratch. Don't forget to set the
  156. activeItem config in order to default to the tab that should display first.</p>
  157. <p><b>Sample Config:</b></p>
  158. <pre><code>
  159. xtype: 'tabpanel',
  160. activeTab: 0, // index or id
  161. items:[{
  162. title: 'Tab 1',
  163. html: 'This is tab 1 content.'
  164. },{
  165. title: 'Tab 2',
  166. html: 'This is tab 2 content.'
  167. },{
  168. title: 'Tab 3',
  169. html: 'This is tab 3 content.'
  170. }]
  171. </code></pre>
  172. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.CardLayout" target="_blank">CardLayout API Reference</a></p>
  173. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.TabPanel" target="_blank">TabPanel API Reference</a></p>
  174. </div>
  175. <div id="card-wizard-details">
  176. <h2>Ext.layout.CardLayout (Wizard)</h2>
  177. <p>You can use a CardLayout to create your own custom wizard-style screen. The layout is a standard
  178. CardLayout with a Toolbar at the bottom, and the developer must supply the navigation function
  179. that implements the wizard's business logic (see the code in basic.js for details).</p>
  180. <p><b>Sample Config:</b></p>
  181. <pre><code>
  182. layout:'card',
  183. activeItem: 0, // index or id
  184. bbar: ['->', {
  185. id: 'card-prev',
  186. text: '&amp;laquo; Previous'
  187. },{
  188. id: 'card-next',
  189. text: 'Next &amp;raquo;'
  190. }],
  191. items: [{
  192. id: 'card-0',
  193. html: 'Step 1'
  194. },{
  195. id: 'card-1',
  196. html: 'Step 2'
  197. },{
  198. id: 'card-2',
  199. html: 'Step 3'
  200. }]
  201. </code></pre>
  202. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.CardLayout" target="_blank">API Reference</a></p>
  203. </div>
  204. <div id="column-details">
  205. <h2>Ext.layout.ColumnLayout</h2>
  206. <p>This is a useful layout style when you need multiple columns that can have varying content height.
  207. Any fixed-width column widths are calculated first, then any percentage-width columns specified using
  208. the <tt>columnWidth</tt> config will be calculated based on remaining container width. Percentages
  209. should add up to 1 (100%) in order to fill the container.</p>
  210. <p><b>Sample Config:</b></p>
  211. <pre><code>
  212. layout:'column',
  213. items: [{
  214. title: 'Width = 25%',
  215. columnWidth: .25,
  216. html: 'Content'
  217. },{
  218. title: 'Width = 75%',
  219. columnWidth: .75,
  220. html: 'Content'
  221. },{
  222. title: 'Width = 250px',
  223. width: 250,
  224. html: 'Content'
  225. }]
  226. </code></pre>
  227. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.ColumnLayout" target="_blank">API Reference</a></p>
  228. </div>
  229. <div id="fit-details">
  230. <h2>Ext.layout.FitLayout</h2>
  231. <p>A very simple layout that simply fills the container with a single panel. This is usually the best default
  232. layout choice when you have no other specific layout requirements.</p>
  233. <p><b>Sample Config:</b></p>
  234. <pre><code>
  235. layout:'fit',
  236. items: {
  237. title: 'Fit Panel',
  238. html: 'Content',
  239. border: false
  240. }
  241. </code></pre>
  242. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.FitLayout" target="_blank">API Reference</a></p>
  243. </div>
  244. <div id="form-details">
  245. <h2>Ext.layout.FormLayout</h2>
  246. <p>FormLayout has specific logic to deal with form fields, labels, etc. While you can use a FormLayout in
  247. a standard panel, you will normally want to use a FormPanel directly in order to get form-specific functionality
  248. like validation, submission, etc. FormPanels use a FormLayout internally so the layout config is not needed
  249. (and the layout may not render correctly if overridden).</p>
  250. <p><b>Sample Config:</b></p>
  251. <pre><code>
  252. xtype: 'form', // FormPanel
  253. labelWidth: 75,
  254. width: 350,
  255. defaultType: 'textfield',
  256. items: [{
  257. fieldLabel: 'First Name',
  258. name: 'first',
  259. allowBlank:false
  260. },{
  261. fieldLabel: 'Last Name',
  262. name: 'last'
  263. },{
  264. fieldLabel: 'Company',
  265. name: 'company'
  266. },{
  267. fieldLabel: 'Email',
  268. name: 'email',
  269. vtype:'email'
  270. }
  271. ],
  272. buttons: [
  273. {text: 'Save'},
  274. {text: 'Cancel'}
  275. ]
  276. </code></pre>
  277. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.FormLayout" target="_blank">API Reference</a></p>
  278. </div>
  279. <div id="table-details">
  280. <h2>Ext.layout.TableLayout</h2>
  281. <p>Outputs a standard HTML table as the layout container. This is sometimes useful for complex layouts
  282. where cell spanning is required, or when you want to allow the contents to flow naturally based on standard
  283. browser table layout rules.</p>
  284. <p><b>Sample Config:</b></p>
  285. <pre><code>
  286. layout:'table',
  287. layoutConfig: {
  288. columns: 3
  289. },
  290. items: [
  291. {html:'1,1',rowspan:3},
  292. {html:'1,2'},
  293. {html:'1,3'},
  294. {html:'2,2',colspan:2},
  295. {html:'3,2'},
  296. {html:'3,3'}
  297. ]
  298. </code></pre>
  299. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.TableLayout" target="_blank">API Reference</a></p>
  300. </div>
  301. <div id="vbox-details">
  302. <h2>Ext.layout.VBoxLayout</h2>
  303. <p>A layout that allows for the vertical and horizontal stretching of child items, much like the container
  304. layout with size management.</p>
  305. <p><b>Sample Config:</b></p>
  306. <pre><code>
  307. layout:'vbox',
  308. layoutConfig: {
  309. align : 'stretch',
  310. pack : 'start',
  311. },
  312. items: [
  313. {html:'panel 1', flex:1},
  314. {html:'panel 2', height:150},
  315. {html:'panel 3', flex:2}
  316. ]
  317. </code></pre>
  318. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.VBoxLayout" target="_blank">API Reference</a></p>
  319. </div>
  320. <div id="hbox-details">
  321. <h2>Ext.layout.HBoxLayout</h2>
  322. <p>A layout that allows for the vertical and horizontal stretching of child items, much like the column
  323. layout but can stretch items vertically.</p>
  324. <p><b>Sample Config:</b></p>
  325. <pre><code>
  326. layout:'hbox',
  327. layoutConfig: {
  328. align : 'stretch',
  329. pack : 'start',
  330. },
  331. items: [
  332. {html:'panel 1', flex:1},
  333. {html:'panel 2', width:150},
  334. {html:'panel 3', flex:2}
  335. ]
  336. </code></pre>
  337. <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.HBoxLayout" target="_blank">API Reference</a></p>
  338. </div>
  339. <!-- Custom layouts -->
  340. <div id="row-details">
  341. <h2>Ext.ux.layout.RowLayout</h2>
  342. <p>This is a custom layout that is useful when you need a layout style with multiple rows of content.
  343. Any fixed-height rows are calculated first, then any percentage-height rows specified using the
  344. <tt>rowHeight</tt> config will be calculated based on remaining container height. Percentages
  345. should add up to 1 (100%) in order to fill the container. Standard panel widths (fixed or
  346. percentage) are also supported.</p>
  347. <p><b>Sample Config:</b></p>
  348. <pre><code>
  349. layout:'ux.row',
  350. items: [{
  351. title: 'Height = 25%',
  352. rowHeight: .25,
  353. width: '50%'
  354. },{
  355. title: 'Height = 100px',
  356. height: 100,
  357. width: 300
  358. },{
  359. title: 'Height = 75%',
  360. rowHeight: .75
  361. }]
  362. </code></pre>
  363. </div>
  364. <div id="center-details">
  365. <h2>Ext.ux.layout.CenterLayout</h2>
  366. <p>This is a custom layout for centering contents within a container. The only requirement is
  367. that the container have a single child panel with a width specified (fixed or percentage).
  368. The child panel can then contain any content, including other components, that will display
  369. centered within the main container. To make the centered panel non-visual, remove the title
  370. and add <tt>border:false</tt> to the child config.</p>
  371. <p><b>Sample Config:</b></p>
  372. <pre><code>
  373. layout:'ux.center',
  374. items: {
  375. title: 'Centered Panel',
  376. width: '75%',
  377. html: 'Some content'
  378. }
  379. </code></pre>
  380. </div>
  381. <!-- Combination layouts -->
  382. <div id="tabs-nested-layouts-details">
  383. <h2>Tabs With Nested Layouts</h2>
  384. <p>There are multiple levels of layout nesting within three different TabPanels in this example.
  385. Each tab in a TabPanel can have its own separate layout. As we can see, some have plain content,
  386. while others contain full BorderLayouts. There is also a fully-loaded grid nested down inside
  387. the inner-most tab, showing that there is no limit to how complex your layout can be.</p>
  388. <p>One of the trickiest aspects of deeply nested layouts is dealing with borders on all the
  389. different panels used in the layout. In this example, body padding and region margins are used
  390. extensively to provide space between components so that borders can be displayed naturally in
  391. most cases. A different approach would be to minimize padding and use the config properties
  392. related to borders to turn borders on and off selectively to achieve a slightly different look
  393. and feel.</p>
  394. </div>
  395. <div id="complex-details">
  396. <h2>Complex Layout</h2>
  397. <p></p>
  398. </div>
  399. <!-- Form layouts -->
  400. <div id="abs-form-details">
  401. <h2>Absolute Layout Form</h2>
  402. <p>FormLayout supports absolute positioning in addition to standard anchoring for flexible control over
  403. positioning of fields and labels in containers. In this example, the top and left positions of the labels
  404. and fields are positioned absolute, while the field widths are anchored to the right and/or bottom of the container.</p>
  405. </div>
  406. </div>
  407. </body>
  408. </html>