Custom Dashboard Sample

You can create custom dashboard types. This sample serves as an example on how to create your own custom dashboard type.

The file myDashboard.js defines an anonymous AMD module that returns a function that allows to create dashboards of a custom type based on the Blueprint dashboard type. Alternatively the Clean or Bootstrap types could have been used. In this case the dashboard was extended with a customize function.

The content of the myDashboard.js file is the following:

define(['cdf/Dashboard.Blueprint', 'cdf/lib/jquery'], function(Dashboard, $) {
  return Dashboard.extend({
    customize: function() {
      $("#sampleObj").html("the dashboard customize function generated this message");
    }
  });
});

Require

To create custom dashboards using the new myDashboard type you can do the following:

require(['./myDashboard'], function(Dashboard) {
  var dashboard = new Dashboard();
  dashboard.init();
  dashboard.customize();
});

The following message is generated after executing the dashboard's customize function: