Ewa.EwaControl.getInstances()
Applies to: apps for SharePoint | SharePoint Server 2010
In this article
Return Value
Remarks
Example
Applies To
Gets the EwaControlCollection object with EwaControl instances that can be used.
var value = Ewa.EwaControl.getInstances();
Return Value
Remarks
[EwaControl.getInstances] is a static method of the EwaControl class that returns the EwaControlCollection for the page.
Example
The following code example shows how to use the EwaControl.getInstances static method to get a reference to the collection of Excel Web Access Web Parts on the page and then uses the Ewa.EwaControlCollection.getItem(index) method get a separate reference to each of the two Excel Web Access Web Parts on the page.
<script type="text/javascript">
// Initialize variables.
var EWA1 = null;
var EWA2 = null;
// Add event handler for onload event.
if (window.attachEvent)
{
window.attachEvent("onload", ewaOmPageLoad);
}
else
{
window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false);
}
// Set page event handlers for onload, proceed to the PageLoad function defined below once the page has loaded if (window.attachEvent){
window.attachEvent("onload", PageLoad);
}
// Add an event handler for the applicationReady event.
function PageLoad()
{
Ewa.EwaControl.add_applicationReady(GetEwa);
}
// Attach to the individual Excel Web Access (EWA) web parts.
function GetEwa()
{
EWA1 = Ewa.EwaControl.getInstances().getItem(0);
EWA2 = Ewa.EwaControl.getInstances().getItem(1);
// ...
}
</script>