Ewa.EwaControl.add_enteredCellEditing(function)

Last modified: June 08, 2011

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example

Subscribes an event handler to the [enteredCellEdit] event.

Ewa.EwaControl.add_enteredCellEditing(function);

function

The event handler to subscribe to the event.

The EwaControl.add_enteredCellEditing method subscribes an event handler to the enteredCellEdit event. The enteredCellEdit event is raised when a user starts to edit a cell. For example, when a user has a cell selected and presses F2.

When the specified event handler for the enteredCellEdit event is invoked, it is invoked with a single argument of type Ewa.RangeEventArgs. The Ewa.RangeEventArgs object contains information about the Ewa.Range associated with the enteredCellEdit event.

Note Note

The Ewa.Range object contains only the values present at the time of entering into cell edit.

The following code example subscribes an event handler to the enteredCellEdit event. The code also shows how to use the Ewa.RangeEventArgs to get information about the specified range.

<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); 
}
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);

    // Add an event handler for the 
    // enteredCellEdit event.
    ewa.add_enteredCellEdit(cellEdit);

    // ...
}
</script>
// Handle the enteredCellEdit event.
function cellEdit(rangeArgs)
{
    // Use the RangeEventArgs object to get information about the range.
    var sheetName = rangeArgs.getRange().getSheet().getName();
    var col = rangeArgs.getRange().getColumn();
    var row = rangeArgs.getRange().getRow();
    var value = rangeArgs.getFormattedValues();
}


Show: