getObjectsToOpen();
The getObjectsToOpen method returns selected repository objects in the dialog box that opens these objects.
This method returns an array of PP.Mb.Object objects.
To execute the example, the HTML page must contain the MetabaseOpenDialog component named metabaseOpenDialog (see Example of creating the MetabaseOpenDialog component). A random object must be selected in the dialog box for opening objects from repository.
Determine key and name of the object selected in the dialog box. Process the OpenObject event showing ID of this object to the browser console:
// Get objects selected in the dialog box var mbObjects = metabaseOpenDialog.getObjectsToOpen(); if (mbObjects.length != 0) { // Get key and name of the first selected object var mbObject = mbObjects[0]; console.log("Object key: " + mbObject.getKey()); console.log("Object name: " + mbObject.getName()); } else { console.log("No selected objects"); }; var args; // Process the OpenObject event metabaseOpenDialog.OpenObject.add(function (sender, args) { console.log("Object identifier: " + args.Objects[0].getId()); });
After executing the example the browser console displays key and name of the object selection in the dialog box. Clicking the OK button fires the OpenObject event, and handler of this event also shows object ID:
Object key: 2283
Object name: Socio Economic Indicators
Object ID: OBJ2283
See also: