X

Shay Shmeltzer's Oracle Development Tools Tips

  • November 7, 2018

Adding Off Canvas Layout to a Visual Builder Application

Shay Shmeltzer
Director of Product Management - Oracle

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 clatter 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:

Menu

List
chart

Gifts


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"
}

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services