Export (0) Print
Expand All

Ewa.EwaControl.add_applicationReady(function)

Last modified: June 08, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example
Applies To

Subscribes an event handler to the applicationReady event.

Ewa.EwaControl.add_applicationReady(function);

function

The event handler to subscribe to the event.

The EwaControl.add_applicationReady method is a static method of the EwaControl object that subscribes an event handler to the applicationReady event. The applicationReady event is raised when all Excel Web Access Web Parts on the page are completely loaded, which indicates that the object model is available for use.

The event handler for the PageLoad event is typically the location to subscribe an event handler for the applicationReady event and the event handler for the applicationReady event is the typical location to get a reference to an Excel Web Access Web Part.

The following code example gets a reference to an Excel Web Access Web Part in the event handler for the applicationReady event.


<script type="text/javascript">
var ewa = null;

// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOmPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOnPageLoad()
{
    if (typeof (Ewa) != "undefined")
    {
        Ewa.EwaControl.add_applicationReady(ewaApplicationReady);
    }
    else
    {
        alert("Error - the EWA JS is not loaded.");
    }
    // ...
}

function ewaApplicationReady()
{
    // Get a reference to the Excel Services Web Part.
    ewa = Ewa.EwaControl.getInstances().getItem(0);
    // ...
}
</script>

Show:
© 2014 Microsoft