Vwa.VwaControl.VwaControl Method
SharePoint 2013
Last modified: August 06, 2011
Applies to: apps for SharePoint | SharePoint Server 2013
Creates a new instance of the VwaControl class.
var value = VwaControl.VwaControl(string elementID)
The following example iterates through all <div> elements on the SharePoint Web Parts page and captures a reference to the first instance of the Visio Web Access Web Part in a global variable.
<script type="text/javascript"> // Declare global variable. var vwaControl; // Hook into the AJAX Sys.Application.load event. Sys.Application.add_load(onApplicationLoad) // Capture a reference to the current session of the Visio Web Access Web Part. function onApplicationLoad() { try{ vwaControl= new Vwa.VwaControl(getVWAWebPartID()); } catch(err){ alert(err); } } // Search theSharePoint page to get the WebPartID# for the Visio Web Access Web Part. function getVWAWebPartID() { // Get a NodesList of all the div tags on the page. var divArray = document.getElementsByTagName("div"); var webPartElementID; // Iterate through the NodesList to get the node with the class attribute "VisioWebAccess." for (var i = 0; i < divArray.length; i++) { var node = divArray[i]; // Return the first instance of the Visio Web Access Web Part. if (node.className == "VisioWebAccess") { webPartElementID = node.parentNode.parentNode.id; break; } } return webPartElementID; } </script>
Show: