https://canvas.atlassian.net/wiki/spaces/CT18v1/pages/709066795/The+View+portClass Description: The class that is expected to render the structure of the application. All Canvas libraries are advised to have header, footer, and content spaces.
...
Sample Code Snippet:
Code Block | ||
---|---|---|
| ||
cbxcanvas.lib.viewport = Class(cbx.core.Component, { initialize: function() { /** * This is the config which will be passed to Workspace Manager */ var viewportConfig = { "eleType": "div", "id":"JQM-CONTENT" }; var viewportConfigObj = new cbx.lib.layer(viewportConfig).getLayer(); this.addItem(viewportConfigObj); var config = { elem: viewportConfigObj }; var applicationLayout = ct.core.metadata.getApplicationLayout(); var headerClass = CLCR.getCmp({'COMP_TYPE':'APPLICATION_HEADER','LAYOUT':applicationLayout}); var header = new headerClass(); $('#HEADER_DIV').append(header.getItem(0).html()); var footerClass = CLCR.getCmp({'COMP_TYPE':'APPLICATION_FOOTER','LAYOUT':applicationLayout}); if(footerClass){ var footer = new footerClass(); $('#FOOTER_DIV').append(footer.getItem(0)); } var that = this; setTimeout(function(){ //Calling the core workspace manager to assign it to this.wsManager with the config object containing the viewport component. that.wsManager = new cbx.core.WSManager(config); //adds the app container as viewport's child. This app container contains the workspace container. that.getItem(0).appendChild(that.wsManager.getContainer().getAppContainer()); $("#CONTENT_DIV").prepend(that.getItem(0)); },500); $(document).ready(function(){ setTimeout(function(){ cbxcanvas.lib.utility.loadInitialWorkspace(); },500); }); } }); CLCR.registerCmp({'VIEW_TYPE':'VIEWPORT'}, cbxcanvas.lib.viewport); |