Use Layouts to wrap window content in themes
masterLayouts allow you to define a consistent UI/theme (HTML/CSS) for your application. When a window is created using a layout, the window's specific content (HTML) is embedded into the layout file at the {{content}} placeholder. The layout can also use {{appBase}} to reference the application's base path.
Workflow:
- Create a layout HTML file with
{{content}}and{{appBase}}placeholders. - Register the layout using
windowManager.layouts.add(name, path). - Apply the layout to a window during creation or via
win.useLayout(name). - (Optional) Set a global default layout in
windowManager.init({ 'defaultLayout': 'name' }).
<!-- layout.html -->
<body>
{{content}} <!-- Window content is injected here -->
<script src="{{appBase}}scripts/bootstrap.js"></script>
</body>// Register a layout
windowManager.layouts.add('default', '/layouts/default.html');
// Apply layout when creating a window
var win = windowManager.createNew('home', 'Welcome', '/pages/welcome.html', false, {'layout': 'default'});
// Or apply to an existing window instance
win.useLayout('default');