| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 | <title>TabContainer doLayout=false Demo</title> |
| 6 | |
| 7 | <script src="../boilerplate.js"></script> |
| 8 | |
| 9 | <script type="text/javascript"> |
| 10 | function testClose(pane,tab){ |
| 11 | return confirm("Please confirm that you want tab "+tab.title+" closed"); |
| 12 | } |
| 13 | |
| 14 | require([ |
| 15 | "dojo/parser", |
| 16 | "dijit/registry", |
| 17 | "dijit/layout/ContentPane", |
| 18 | "dijit/layout/TabContainer", |
| 19 | "dijit/Tooltip", |
| 20 | "dojo/domReady!" |
| 21 | ], function(parser, registry, ContentPane){ |
| 22 | |
| 23 | var tab = 6; |
| 24 | |
| 25 | addTab = function(){ |
| 26 | cp = new ContentPane({id: 'newTab' + tab, title: 'Tab' + tab, closable: true}); |
| 27 | cp.domNode.innerHTML = "Contents of Tab " + tab++; |
| 28 | registry.byId("plainTabContainer").addChild(cp); |
| 29 | }; |
| 30 | |
| 31 | parser.parse(); |
| 32 | }); |
| 33 | </script> |
| 34 | </head> |
| 35 | <body class="claro" role="main"> |
| 36 | |
| 37 | <script type="dojo/require"> |
| 38 | registry: "dijit/registry" |
| 39 | </script> |
| 40 | |
| 41 | <h1 class="testTitle">Dijit layout.TabContainer doLayout=false tests</h1> |
| 42 | |
| 43 | <p> |
| 44 | This tests tabs in doLayout=false mode, in which case the tab container's height == |
| 45 | the height of the currently selected tab. |
| 46 | </p> |
| 47 | <p> |
| 48 | With doLayout=false mode tabs only (the default) tabPosition=top is supported. |
| 49 | </p> |
| 50 | |
| 51 | <button id="addTabButton" onclick="addTab();">add tab</button> |
| 52 | <button id="destroyTabContainer" onclick="registry.byId('plainTabContainer').destroyRecursive();">destroy tab container</button> |
| 53 | |
| 54 | <div id="plainTabContainer" data-dojo-type="dijit/layout/TabContainer" data-dojo-props='doLayout:false, style:"width: 700px;"'> |
| 55 | |
| 56 | <div id="tab1" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"tab1.html", title:"Tab 1"'></div> |
| 57 | |
| 58 | <div id="tab2" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"tab2.html", refreshOnShow:true, title:"Tab 2", selected:true'></div> |
| 59 | |
| 60 | <div id="tab3" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"Tab 3"'> |
| 61 | <h1 id="h3">I am tab 3</h1> |
| 62 | <p id="p3">And I was already part of the page! That's cool, no?</p> |
| 63 | <span id="foo">tooltip on this span</span> |
| 64 | <div data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["foo"]'>I'm a tooltip!</div> |
| 65 | <button id="b3" data-dojo-type="dijit/form/Button">I'm a button </button> |
| 66 | <br> |
| 67 | <button id="b4" data-dojo-type="dijit/form/Button">So am I!</button> |
| 68 | <p id="p4"> |
| 69 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean |
| 70 | semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. Proin |
| 71 | porta rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi. |
| 72 | Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis. |
| 73 | Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae |
| 74 | risus. |
| 75 | </p> |
| 76 | <p id="p5">Aliquam vitae enim. Duis scelerisque metus auctor est venenatis |
| 77 | imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem |
| 78 | nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in |
| 79 | massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In |
| 80 | pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra |
| 81 | quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia, |
| 82 | felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut |
| 83 | quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla |
| 84 | rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut |
| 85 | semper velit ante id metus. Praesent massa dolor, porttitor sed, |
| 86 | pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit |
| 87 | tortor pharetra congue. Suspendisse pulvinar. |
| 88 | </p> |
| 89 | </div> |
| 90 | |
| 91 | <div id="tab4" data-dojo-type="dijit/layout/TabContainer" data-dojo-props='title:"Tab 4", doLayout:false, nested:true'> |
| 92 | <div id="tab4a" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"tab1.html"' title="SubTab 1"></div> |
| 93 | <div id="tab4b" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"tab2.html", selected:true' title="SubTab 2"></div> |
| 94 | </div> |
| 95 | |
| 96 | <div id="tab5" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"tab3_noLayout.html", doLayout:false' title="Tab 5"></div> |
| 97 | </div> |
| 98 | |
| 99 | <p id="textAfterTabContainer1"> |
| 100 | Some text here. This should appear directly below the TabContainer, |
| 101 | and the position will change based on the current height of the TabContainer. |
| 102 | </p> |
| 103 | |
| 104 | </body> |
| 105 | </html> |