Spread for ASP.NET 10 Product Documentation
CallBack

Calls back to the ASPX page with the specified command.

Syntax

[JavaScript]

FpSpread1.CallBack(cmd, asyncCallBack);

Parameters

cmd
String, the command to post back
See the list of reserved commands below
asyncCallBack
Boolean, whether to allow an asynchronous callback

Reserved Commands

The following pre-defined commands are built into Spread. These are reserved command names; do not use these names for any custom commands that you create, as Spread ignores the custom definition and uses the built-in definition. Not all the commands have corresponding events.

Reserved Command Name Corresponding FpSpread Event Description

ActiveSpread

- -

reserved for internal use for down-level browsers; makes a specified Spread component the active component

Add

InsertCommand

adds a row and raises the event

Cancel

CancelCommand

cancels the operation and raises the event

CellClick

CellClick

clicks a cell using the left mouse button

Chart

- -

used with Chart control

ChildView

ChildViewCreated

displays a specified child view when the HierarchicalView property is set to False and raises the event

Color

AutoFilteredColumn 

AutoFilteringColumn

used in filter feature

ColumnHeaderClick

ColumnHeaderClick

same as click in column header and raises the event

Date

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Delete

DeleteCommand

deletes a row and raises the event

Edit

EditCommand

same as Edit button and raises the event

ExpandView

ChildViewCreated

expands or collapses a specified row; raises the event; when row is expanded to display a child view, raises the ChildViewCreated event

Filter$reset

- -

clears the filter in the specified column

First

TopRowChanged

moves to the first page on the sheet

Group

Grouped

Grouping

groups the rows

GroupBar

Grouped

used for the group bar

Icon

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Insert

InsertCommand

adds a row at a particular place and raises the event

Last

TopRowChanged

moves to the last page on the sheet

LoadOnDemand

- -

loads rows as needed

Menu

MenuItemClicked

used with context menu

MoveCol

- -

moves the column

MultiValues

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Next

TopRowChanged

moves to the next page on the sheet

Number

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Page

TopRowChanged

moves to a specified page on the sheet

Prev

TopRowChanged

moves to the previous page on the sheet

Print

PrintSheet

prints the sheet

PrintPDF

PrintPDF

prints the sheet to a PDF document

RefreshChart

- -

used with Chart control

Regroup

Grouped

Grouping

groups the rows again

RetrieveFilterBarMenus - - used in dynamic mode for the filter bar

RowHeaderClick

RowHeaderClick

clicks a cell in the row header

ScrollDownToPage

TopRowChanged

moves down a page

ScrollUpToPage

TopRowChanged

moves up a page

Select

ActiveRowChanged

reserved for internal use for down-level browsers; selects a specified row

SelectView

ActiveSheetChanged

moves to a specified sheet

SortAZ

- -

sorts the column in ascending order

SortColumn

SortColumnCommand

sorts a column

SortZA

- -

sorts the column in descending order

TabLeft

- -

displays the previous sheet tabs to the left

TabRight

- -

displays the next sheet tabs to the right

Text

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Top10

AutoFilteredColumn

AutoFilteringColumn

used in filter feature

Ungroup

Ungrouped

removes the group

Update

UpdateCommand

saves the changes

UpdateValues

- -

used when FpSpread.ClientAutoCalculation is True; Spread updates its calculated value immediately after the user enters a formula

GC$InsertRow - - inserts rows above the selected row when using the touch insert row menu button, the number of additional rows is equal to the selected rows
GC$DeleteRow - - deletes selected rows when using the touch delete menu button
GC$HideRow - - hides the selected rows when using the touch hide menu button
GC$UnhideRow - - makes invisible rows visible in the selection range
GC$InsertColumn - - inserts columns above the first selected column when using the touch insert column menu button
GC$DeleteColumn - - deletes selected columns when using the touch delete column menu button
GC$HideColumn - - hides the selected columns when using the touch hide column menu button
GC$UnhideColumn - - makes invisible columns visible in the selection range

For those commands that correspond with command events in FpSpread, using these commands with the CallBack function basically behaves the same as if you had clicked the appropriate command bar button.

The ChildView command looks like this:

     FpSpread1.CallBack("ChildView,relationname")

where relationname is the name of the relation you are trying to view.

The ExpandView command looks like this:

     FpSpread1.CallBack("ExpandView,rownum")

where rownum is the zero-indexed row number to expand. For example, a rownum of 2 expands the third row of the parent sheet (since row indexes are zero-indexed). If you want to expand a row below the parent sheet level, you have to know the name of the sheet at that level. This code expands the fourth row at the particular level in the hierarchy:

     function DoCallBack() {           var ss = event.spread;           ss.CallBack("ExpandView,3");      }

The Page command looks like this:

     FpSpread1.CallBack("Page,pagenum")

where pagenum is the zero-indexed page number on the active sheet. For example, a pagenum of 2 scrolls to the third page on the active sheet, since the sheets are zero-indexed.

Note: Using the CallBack method when the Spread control fires an event can cause an incorrect state. Try code similar to the following to prevent this:

JavaScript
Copy Code
function SelectionChanged(e) {
 setTimeout(function() {
  spread.Callback("Update");
 }, 0);
}

Custom Commands

If you use a string to define a CallBack with a command that is not a one of the built-in commands, Spread raises the ButtonCommand event for the Spread component and passes in the name of the custom CallBack command as e.CommandName, as shown in this example code.

In JavaScript:

FpSpread1.CallBack("MyCommand", false)

In corresponding server-side code (Visual Basic .NET):

VB .NET
Copy Code
Private Sub FpSpread1_ButtonCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles FpSpread1.ButtonCommand
If e.CommandName = "MyCommand" Then
FpSpread1.Sheets(0).Cells(0, 0).Text = "My Command Worked"
End If
End Sub

Return Type

None

Examples

This is a sample that contains the method with one of the built-in commands. On the client side, the script that contains the method would look like this:

JavaScript
Copy Code
<script type="text/javascript">
   function SortIt() {
       FpSpread1.CallBack(SortColumn, false);
   }
</script>

This is a sample showing a simple way of programmatically doing an AJAX postback that raises the UpdateCommand event:

JavaScript
Copy Code
<script language="javascript">
  function window.onload() {
    FpSpread1.onDataChanged = DoCallBack;
  }
  function DoCallBack() {
    FpSpread1.UpdatePostbackData();
    FpSpread1.CallBack("Update", true);
  }
</script>
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback