Share via


Ewa.Workbook.remove_sheetDataEntered(function)

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

Unsubscribes the specified event handler from the sheetDataEntered event.

Ewa.Workbook.remove_sheetDataEntered(function);

Parameters

function

The event handler to unsubscribe from the event.

Return value

None.

Example

The following code example shows how to unsubscribe the specified event handler for the [sheetDataEntered] 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;

// Run the Excel load handler on page load
if (window.attachEvent) {
    window.attachEvent("onload", loadEwaOnPageLoad);
} else {
    window.addEventListener("DOMContentLoaded", loadEwaOnPageLoad, false);
}

// Event handler for page load event 
function loadEwaOnPageLoad() {
    if (typeof (Ewa) != "undefined") {
        // Retrieve workbook from SharePoint location when EWA is ready
        Ewa.EwaControl.add_applicationReady(ewaApplicationReady);
    }
    else {
        alert("Error - the EWA is not loaded.");
    }
    // ...
}

function ewaApplicationReady() {
    // Get a reference to the EWA web part that represents the Ewa web part
    // in SharePoint:
    ewa = Ewa.EwaControl.getInstances().getItem(0);
    // Add event handler for the sheetDataEntered event
    ewa.getActiveWorkbook().add_sheetDataEntered(sheetDataEnteredHandler);    
}

function sheetDataEnteredHandler(rangeChangeArgs) {
    var sheetName = rangeChangeArgs.getRange().getSheet().getName();
    var col = rangeChangeArgs.getRange().getColumn();
    var row = rangeChangeArgs.getRange().getRow();
    var value = rangeChangeArgs.getFormattedValues();
    alert("The range was located at row " + (row + 1) + " and column " + (col + 1) + " with value " + "\"" + value + "\"" + ".");
}

/* Given the preceding code, unsubscribe the given 
event handler from the sheetDataEntered event. */

function myRemoveHandlerFunction(handler) {
    // Unsubscribe the event handler from the workbook
    ewa.getActiveWorkbook().remove_sheetDataEntered(handler);    
    // ...
}
</script>

See also

Reference

Ewa.Workbook.add_sheetDataEntered(function)

Ewa.Workbook Object