Source: PP.TS.WbkDocument;
The Source property specifies data source for base category of workbook ribbon.
Use JSON or the setSource method to set the property value, and the getSource method to get the property value.
To execute the example, the HTML page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component). Get key of the data source for ribbon base category:
// Get ribbon
var ribbon = workbookBox.getRibbonView();
// Get the Home ribbon category
var mainCategory = ribbon.getMainCategory();
// Set a data source for this category if it is missing
var source = mainCategory.getSource(); // Get data source
if (source == null | source == undefined) {
mainCategory.setSource(workbookBox.getSource());
console.log("Data source key: " + mainCategory.getSource().getKey());
} else {
console.log("Data source key: " + source.getKey());
};
After executing the example the browser console displays key of the data source for base category of workbook ribbon:
Data source key: 2944
See also: