Detached Panels

The TabPanel has a built-in panel that shows the content of the selected tab. In some cases, you may want to display the content in a different element. This sample demonstrates hiding the build-in panel and displaying other content when the selection changes (using the selectedIndexChanged event).

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as wjNav from '@grapecity/wijmo.nav'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { var theTabPanel = new wjNav.TabPanel('#theTabPanel', { // show the content for the selected tab in a separate div selectedIndexChanged: function (s, e) { var div = document.getElementById('detachedContent'); div.innerHTML = 'Content for tab <b>' + s.selectedTab.header.textContent + '</b>...'; } }); // hide the built-in content area theTabPanel.hostElement.querySelector('.wj-tabpanes').style.display = 'none'; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo TabPanel Detached Panels</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div id="theTabPanel"> <div> <a>Africa</a> <div></div> <!-- no content --> </div> <div> <a>America</a> <div></div> </div> <div> <a>Asia</a> <div></div> </div> <div> <a>Europe</a> <div></div> </div> <div> <a>Oceania</a> <div></div> </div> </div> <p></p> <div class="panel panel-success"> <!-- separate div to show the content --> <div class="panel-heading"> <h3 id="detachedContent" class="panel-title"></h3> </div> </div> </div> </body> </html> .wj-tabpane { padding: 12px; } body { margin-bottom: 48pt; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjNavModule, WjTabPanel } from '@grapecity/wijmo.angular2.nav'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { selectedTabContent: string; // constructor() { } selectTab(s: WjTabPanel) { this.selectedTabContent = 'Content for tab <b>' + s.selectedTab.header.textContent + '</b>...'; } } // @NgModule({ imports: [WjNavModule, BrowserModule], declarations: [AppComponent], providers: [], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo TabPanel Detached Panels</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <wj-tab-panel #dPanel (selectedIndexChanged)="selectTab(dPanel)"> <wj-tab> <a>Africa</a> <div> </div> </wj-tab> <wj-tab> <a>America</a> <div> </div> </wj-tab> <wj-tab> <a>Asia</a> <div> </div> </wj-tab> <wj-tab> <a>Europe</a> <div> </div> </wj-tab> <wj-tab> <a>Oceania</a> <div> </div> </wj-tab> </wj-tab-panel> <p></p> <div class="panel panel-success"> <!-- separate div to show the content --> <div class="panel-heading"> <h3 id="detachedContent" class="panel-title" [innerHtml]="selectedTabContent"></h3> </div> </div> </div> .wj-tabpane { padding: 12px; } body { margin-bottom: 48pt; }