DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How to Build Scalable Mobile Apps With React Native: A Step-by-Step Guide
  • Scaling Mobile App Performance: How We Cut Screen Load Time From 8s to 2s
  • Interrupt Testing: Bulletproof Your App for the Real World
  • In-App Browsers in Mobile Apps: Benefits, Challenges, Solutions

Trending

  • Agile’s Quarter-Century Crisis
  • The Future of Java and AI: Coding in 2025
  • The Role of AI in Identity and Access Management for Organizations
  • Navigating Change Management: A Guide for Engineers

Adding Off Canvas Layout to a Visual Builder Application [Video]

In this video tutorial, we take a look at how to add this popular UI layout choice using a built-in component in Oracle JET.

By 
Shay Shmeltzer user avatar
Shay Shmeltzer
·
Nov. 12, 18 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
9.0K Views

Join the DZone community and get the full member experience.

Join For Free

Off Canvas layout is a common UI pattern for modern applications, especially on mobile devices. The concept is aimed at saving space on your page, allowing you to pop out a "drawer" of additional information. This helps reduce clutter on the main page but still provide access to important data when needed without leaving the page context. You can see an example of the runtime behavior at the top of this post.

Oracle JET provides this type of "off-canvas" behavior as a built in component, and they have a demo of it working as part of the cookbook here.

In the video below I show you how to add this to a Visual Builder application. As always, you can mostly just copy and paste code from the JET cookbook, but you need to handle some of the importing of resources a little different, and use the Visual Builder approach for adding your JavaScript function.


The code used in the video is:

Page source:

<div class="oj-offcanvas-outer-wrapper">
  <div id="startDrawer" class="oj-offcanvas-start oj-panel oj-panel-alt5 oj-offcanvas-overlay-shadow" style="width: 200px">
    <div class="oj-flex">
      <h2 id="h1-1660298733-2" class="oj-flex-item oj-sm-12 oj-md-12 selectionShareable">Menu</h2>
    </div>
    <div class="oj-flex">
      <span class="oj-flex-item oj-sm-12 oj-md-1 vb-icon vb-icon-list" id="span-1660298733-1"></span>
      <oj-label id="oj-label-1660298733-1" class="oj-flex-item oj-sm-12 oj-md-3">List</oj-label>
    </div>
    <div class="oj-flex">
      <span class="oj-flex-item oj-sm-12 oj-md-1 vb-icon vb-icon-pie" id="span-1660298733-2"></span>
      <oj-label id="oj-label-1660298733-2" class="oj-flex-item oj-sm-12 oj-md-3">chart</oj-label>
    </div>
  </div>
  <div id="mainContent" class="demo-main-content">
    <div class="oj-flex">
      <span class="oj-flex-item oj-sm-12 oj-md-1 vb-icon vb-icon-hamburger-menu" id="span-1660298733-3" on-click="[[$listeners.span16602987333Click]]"></span>
      <h2 id="h1-1660298733-1" class="oj-flex-item oj-sm-12 oj-md-10 selectionShareable">Gifts</h2>
    </div>
    <div class="oj-flex">
      <hr id="hr-1660298733-1" class="oj-flex-item oj-sm-12 oj-md-12">
    </div>
    <div class="oj-flex">
      <oj-list-view id="oj-list-view-1660298733-1" class="oj-flex-item oj-sm-12 oj-md-12" data="[[$page.variables.giftsListSDP]]">
        <template slot="itemTemplate">
            <oj-vb-list-item>
                <img slot="image" :src="[[$current.data.picture]]" width="32" height="32">
                <p slot="title1">
                    <oj-bind-text value="[[$current.data.product]]"></oj-bind-text>
                </p>
                <p slot="value1">
                    <oj-bind-text value="[[$current.data.cost]]"></oj-bind-text>
                </p>
                <p slot="title2">
                    <oj-bind-text value="[[$current.data.sKU]]"></oj-bind-text>
                </p>
            </oj-vb-list-item>
        </template>
      </oj-list-view>
    </div>
  </div>
</div>

JavaScript function in the page:

define(['ojs/ojcore'], function(oj) {
  'use strict';

  var PageModule = function PageModule() {};

  PageModule.prototype.showSide = function() {
    var offcanvas = {
      "selector": "#startDrawer",
      "content": "#mainContent",
      "edge": "start",
      "displayMode": "push",
      "size": "200px"
    };

    oj.OffcanvasUtils.open(offcanvas);

  }

  return PageModule;
});

and in your page JSON file add this import:

"oj-offCanvas": {
  "path": "ojs/ojoffcanvas"
}
mobile app

Published at DZone with permission of Shay Shmeltzer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Build Scalable Mobile Apps With React Native: A Step-by-Step Guide
  • Scaling Mobile App Performance: How We Cut Screen Load Time From 8s to 2s
  • Interrupt Testing: Bulletproof Your App for the Real World
  • In-App Browsers in Mobile Apps: Benefits, Challenges, Solutions

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!