TSService.openUnitDim

Syntax

openUnitDim (wbk, callback);

Parameters

wbk. Sets workbook value.

callback. Sets handler for operation execution end.

Description

The openUnitDim method opens measurement units dictionary.

Example

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:

	//Open units dictionary
	tsService.openUnitDim(wbk, onOpenUnitDim);
	//openUnitDim method execution end event handler
	function onOpenUnitDim(sender, args){
		var alertString = "";
		//Transform server response text to JSON object
		var res = JSON.parse(args.ResponseText);
		//Get units from the server response and display unit names
		for (var i = 0; i < res.GetDimElementsResult.els.e.length; i++)
		{
			alertString += "Unit № " + (i+1) + " - " + res.GetDimElementsResult.els.e[i].n + '\n';
		}
		alertString += "Total - " + res.GetDimElementsResult.els.e.length;
		alert(alertString);
	}

After executing the example the message with the list of measurement units available in the source is displayed on the screen.

See also:

TSService