Export (0) Print
Expand All

Ewa.EwaControl.add_applicationReady(function)

apps for Office and SharePoint

Last modified: October 03, 2012

Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013

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. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.


<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:
© 2015 Microsoft