createWbkFromRub (key, userCallback, callbackAfterOpenHierarchy);
key. Sets key of time series database.
userCallback. Sets handler for operation execution end.
callbackAfterOpenHierarchy. Sets handler to process end of opening series hierarchy in a workbook.
The createWbkFromRub method creates a workbook based on time series database and opens this workbook.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and also add the following code in the handler, that processes document opening event:
var createWbkFromRubButt = new PP.Ui.Button({
ParentNode: document.body, //DOM parent node
Content: "Create Workbook", //Text
Click: PP.Delegate(onClickCreateWbkFromRub)
});
function onClickCreateWbkFromRub()
{
//Get time series database key
var key = wbk.getWbkMetadata().rubrs.def.k;
//Create a workbook from the time series database and open it
tsService.createWbkFromRub (key, PP.Delegate(onWbkCreatedFromRub, this));
function onWbkCreatedFromRub(sender, args){
//Get the created workbook
var newWorkbook = args.Workbook;
//Assign a new source to the workbookBox component
workbookBox.setSource(newWorkbook);
}
}
After executing the example the WorkbookBox component and a button named Create Workbook are added to the HTML page. On clicking the button a new workbook is created in the repository and opened.
See also: