WbkDocument.ActiveSheetKey

Syntax

ActiveSheetKey: Number;

Description

The ActiveSheetKey property determines key of active sheet.

Example

To execute the example, in the HEAD tag of the HTML page specify links to the following CSS and JS files:

A workbook must be created and saved to desktop application, key of the created workbook is to be saved to the variable KEY.

In the <body> tag as the value of the onLoad attribute specify name of the function executed after page body loading is finished:

<body onload="Ready()">
	<div id='example'></div>
</body>

In the SCRIPT tag add the following script:

<script type="text/javascript">
	// Determine language settings for resources
	PP.setCurrentCulture(PP.Cultures.ru);				
	// Declare constants
	var KEY = 857804; //document key		
	// Declare variables
	var waiter, metabase, tsService, wbkDocument;		
	function Ready() { //body loading event handler
		 // Create loading indicator
		waiter = new PP.Ui.Waiter();
		// Create repository connection
		metabase = new PP.Mb.Metabase(
		{
				Id: "WAREHOUSE",
				UserCreds: { UserName: "user", Password: "password" },
				StartRequest: function () {
					waiter.show();
				},
				EndRequest: function () {
					waiter.hide();
				},
				Error: function (sender, args) {
					alert(args.ResponseText);
				}
		});
			// Open repository connection
		metabase.open();
		// Create a service for working with time series
		tsService = new PP.TS.TSService({ Metabase: metabase });
		// Open document
		tsService.openDocument(KEY, onFirstOpened);
		// Document open event handler
		function onFirstOpened(sender, args)
		{
			// Get workbook instance of time series database
			wbkDocument = args.Workbook;
			console.log("workbook instance from time series database");
			console.log(wbkDocument);
			var sheetKey = wbkDocument.getActiveSheetKey();
			console.log("current sheet number");
			console.log(sheetKey);							
		}
	}
</script>

After executing the example the browser console displays an instance of workbook from time series database and the number of the current sheet:

an instance of workbook from time series database

PP.TS.WbkDocument {_DimsObs: Object, _HasChildren: false, _Selection: null, _SelectedIndexSeries: null, _KeysSeries: Array[0]…}

number of the current sheet

1

See also:

WbkDocument