cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <table id="table" summary="Department List" aria-label="Departments Table"
       data-bind="ojComponent: {component: 'ojTable', 
                                data: datasource, 
                                columns: [{headerText: 'Department Id', 
                                           field: 'DepartmentId'},
                                          {headerText: 'Department Name', 
                                           field: 'DepartmentName'},
                                          {headerText: 'Location Id', 
                                           field: 'LocationId'},
                                          {headerText: 'Manager Id', 
                                           field: 'ManagerId'}]}">
</table>
            
          
!
            
              @import url('//cdn.rawgit.com/oracle/oraclejet/2a420014546d371d076ec741ef171f0a3c71f28d/dist/css/alta/oj-alta-min.css');
            
          
!
            
              requirejs.config({
  // Path mappings for the logical module names
  paths: {
    'knockout': '//cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min',
    'jquery': '//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min',
    "jqueryui": "//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui",
    "jqueryui-amd": "//cdn.rawgit.com/jquery/jquery-ui/1-11-stable/ui",

    "promise": "//cdn.rawgit.com/components/es6-promise/c95149ffaa2e8162601c57d4282362eac84f929b/promise.min",
    "hammerjs": "//cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.4/hammer.min",
    "ojdnd": "//cdn.rawgit.com/oracle/oraclejet/2a420014546d371d076ec741ef171f0a3c71f28d/dist/js/libs/dnd-polyfill/dnd-polyfill-1.0.0.min",
    "ojs": "//cdn.rawgit.com/oracle/oraclejet/2a420014546d371d076ec741ef171f0a3c71f28d/dist/js/libs/oj/min",
    "ojL10n": "//cdn.rawgit.com/oracle/oraclejet/2a420014546d371d076ec741ef171f0a3c71f28d/dist/js/libs/oj/ojL10n",
    "ojtranslations": "//cdn.rawgit.com/oracle/oraclejet/2a420014546d371d076ec741ef171f0a3c71f28d/dist/js/libs/oj/resources",
    "text": "//cdnjs.cloudflare.com/ajax/libs/require-text/2.0.12/text.min",
    "signals": "//cdnjs.cloudflare.com/ajax/libs/js-signals/1.0.0/js-signals.min"

  },
  // Shim configurations for modules that do not expose AMD
  shim: {
    'jqueryui-amd': {
      exports: "$",
      deps: ['jquery']
    },
    'jquery': {
      exports: ['jQuery', '$']
    }
  },
  config: {
    ojL10n: {
      merge: {
        //'ojtranslations/nls/ojtranslations': 'resources/nls/menu'
        // The following addes en-US to the r.js bundle
        //'ojtranslations/nls/ojtranslations': '../../oj/resources/nls/en-US/localeElements'
      }
    }
  }
});

require(['knockout',
  'ojs/ojcore',
  'jquery',
  'ojs/ojknockout',
  'ojs/ojmodel',       
 'ojs/ojtable', 'ojs/ojcollectiontabledatasource'
], function(ko, oj, $) {
  'use strict';

  var ViewModel = function() {
     var self = this;
     
     self.DeptCol = ko.observable();
     self.datasource = ko.observable();
     self.serviceUrl = "https://codepen.io/cliffsanchez/pen/pbKmEy.html";
     // parse the response
     self.parseDept = function (response){
       return {
         DepartmentId: response['DepartmentId'],
         DepartmentName: response['DepartmentName'],
         LocationId: response['LocationId'],
         ManagerId: response['ManagerId']
       };
     };
     // Define the oj.Model
     self.Department = oj.Model.extend({
       parse: self.parseDept,
       idAttribute: 'DepartmentId'
     });
    
     // Create an instance of oj.Model
     self.myDept = new self.Department();
    
     // Define the collection
     self.DeptCollection = oj.Collection.extend({
       url: self.serviceUrl,
       model: self.myDept
     });
     // set the collection to a ko variable
     self.DeptCol(new self.DeptCollection());
     // set the observable variable to as the datasource
     self.datasource(new oj.CollectionTableDataSource(self.DeptCol()));
  };
  ko.applyBindings(new ViewModel());
});
            
          
!
999px
Loading ..................

Console