Microsoft Office Tutorials and References
In Depth Information
5.
With the activeSelectionChangedHandler , when a user changes a selection on the eWa
Web part, you need to capture the selection sheet and the range of the selection:
var selection = rangeArgs.getRange();
var selectedSheet = selection.getSheet().getName();
6.
retrieve the values of the selected range:
var selectedValues = rangeArgs.getFormattedValues();
7.
assign the value retrieved in previous step to Div text:
document.getElementById('ewaText').firstChild.data = selectedValues;
all of this together becomes the final code as follows:
<script type="text/javascript">
var ewaWebPart = null;
if(window.attachEvent)
{
window.attachEvent("onload", Page_Load);
}
function Page_Load()
{
Ewa.EwaControl.add_applicationReady(GetEwaWebpart);
}
function GetEwaWebpart()
{
ewaWebPart = Ewa.EwaControl.getInstances().getItem(0);
if(ewaWebPart)
{
ewaWebPart.add_activeSelectionChanged(activeSelectionChangedHandler);
}
}
function activeSelectionChangedHandler(rangeArgs)
{
var selection = rangeArgs.getRange();
var selectedSheet = selection.getSheet().getName();
var selectedValues = rangeArgs.getFormattedValues();
if(selectedSheet = "Sheet1")
{
document.getElementById('ewaText').firstChild.data = selectedValues;
}
}
</script>
<div id="ewaText" style="font-family: Verdana; font-style: bold; font-size:14pt;
color:red;">&nbsp;</div>
8.
Copy this code to a file, and save it as a JSOM.html file.
Search JabSto ::




Custom Search