The Spread component can support client-side code IntelliSense. This requires a minimum of Visual Studio 2010. This feature allows you to type the name of the control and get a list of available methods and properties. Some browsers may not support certain properties and methods.
After support has been added, type the control name followed by a dot to see the list.
This features requires the FpSpreadJsIntellisense.js file located in the fp_client folder. Use the following steps:
Code |
Copy Code
|
---|---|
<%If (False) Then%> <script type="text/javascript" src="./ClientResources/FpSpreadJsIntellisense.js"></script> <% End If%> function SomeFunction() { var spread = FpSpread("FpSpread1"); // This variable declaration is necessary for the autocomplete. // Type spread. here to see the autocomplete. } |
The final aspx page might appear as follows:
Code |
Copy Code
|
---|---|
<title>Untitled Page</title> <%If (False) Then%> <script type="text/javascript" src="./ClientResources/FpSpreadJsIntellisense.js"></script> <% End If%> <script language="javascript" type ="text/javascript" > window.onload = function () { var ss = document.getElementById("<%=FpSpread1.ClientID %>"); if (document.all) { // IE if (ss.addEventListener) { // IE9 ss.addEventListener("DataChanged", DataChanged, false); } else { // Other versions of IE and IE9 quirks mode (no doctype set) ss.onDataChanged = DataChanged; } } else { // Firefox ss.addEventListener("DataChanged", DataChanged, false); } } function DataChanged(event) { var spread = FpSpread("FpSpread1"); > // TYPE spread. here to see the auto-complete. } </SCRIPT> |
The <% if %> block will evaluate to false at run time since this code is only used for code autocomplete.
Client-side autocomplete support can also be used in a stand-alone js file with the following code (this line must be before any script):
Code |
Copy Code
|
---|---|
<reference name="FarPoint.Web.Spread.htc.FpSpreadJsIntellisense.js" assembly="FarPoint.Web.Spread" /> |