HieService.getChildEls

Syntax

getChildEls (hie, parentKey, callback);

Parameters

hie. Sets hierarchy object.

parentKey. Sets value of child element key.

callback. Sets handler for operation execution end.

Description

The getChildEls method is used to load child elements.

Example

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

This example requires a time series database with the 1334 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 HTML page body add the following script:

	<script type="text/javascript">
		// Declare constants
		var RUB_KEY = 1334;
	
		// Declare variables
		var metabase, hieSrv, hie;
		PP.ImagePath = "../build/img/";
		PP.ScriptPath = "../build/";
		PP.CSSPath = "../build/";
		
		// Factory of dummy handlers
		function onDummyActionFactory(actionCaption){
			return function (sender, args){
				console.log(actionCaption);
				console.log(args);
			};
		}
		function Ready() //body loading event handler
		{
			metabase = new PP.Mb.Metabase({
				Id: "p7mart_ms",
				UserCreds: { UserName: "sa", Password: "H88cp229" },
				Error: function (sender, args){alert(args.ResponseText);}
			});
			// Open repository connection
			metabase.open();
			hieSrv = new PP.TS.HieService({ Metabase: metabase });
			hieSrv.HieOpened.add(onDummyActionFactory("Series hierarchy is opened"));
			//Send a request to open workbook hierarchy
			hieSrv.open(null, null, RUB_KEY, new PP.Delegate(onOpened));
			
			function onOpened (sender, res)
			{
				//Get metadata hierarchy instance
				hie = res.Args.Hier;
				console.log(hie);
				hieSrv.ElementsLoaded.add(onDummyActionFactory("Child element get event occurred"));
				
				//Send a request to get child elements
				hieSrv.getChildEls(hie, "", function(sender, res){
					console.log("Response to get child elements is received");
					console.log(res);
				
				});
			}
		}
	</script>

After executing the example a service for working with hierarchy of time series database is created. Hierarchy of the time series database with the 1334 key opens, and next the console shows an appropriate message. After opening hierarchy of the time series database, the ElementsLoaded event creates and sends a request to get hierarchy children. On firing the HieOpened event the console shows the following message: Event of getting child elements has occurred. After getting the children the console shows the following: Got a response to the child element request.

See also:

HieService