Class: DashboardFactory

DashboardFactory

Factory class that is used to instantiate a DashboardApi instance.
DashboardFactory can not be instantiated directly. DashboardFactory can be obtained through an instance of CognosApi.
Example
// Create an instance of the CognosApi
const api = new CognosApi({
	cognosRootURL: 'http://localhost/bi/',
	node: document.getElementById('containerDivId'),
	sessionCode: 'CD1a2b34567b8c901234d5'
});

// initialize the CognosApi in order to obtain the service APIs
api.initialize().then(() => {
	// create a new dashboard through the dashboard factory
	api.dashboard.createNew();
	...
	// open an existing dashboard through the dashboard factory
	api.dashboard.openDashboard();
	...
});

Methods

createNew()

Create a DashboardApi instance of a new dashboard
Example
const dashboardApi = null;
api.dashboard.createNew().then((dashboardAPI) => {
	console.log('Dashboard created successfully.');
	dashboardApi = dashboardAPI;
}).catch((err) => {
	console.log('Cancelled by user.');
});

openDashboard()

Create a DashboardApi instance of an existing dashboard
Parameters:
Name Type Description
option.dashboardSpec Object dashboard specification to open
See:
Example
const dashboardApi = null;
api.dashboard.openDashboard({
	dashboardSpec: {...}
}).then((dashboardAPI) => {
	console.log('Dashboard opened successfully.');
	dashboardApi = dashboardAPI;
});