JS Grid Control Events

Applies to: SharePoint Foundation 2010

The JS Grid control offers the following client side events:

JS Grid Events

Event

Description

OnBeforeGridDispose

Occurs before the grid is disposed. Occurs once in the lifetime of the control.

OnCellEditBegin

Occurs when the user begins editing (such as by a keystroke, double-click) in an edit control or widget.

OnCellEditCompleted

Occurs after the user has finished editing a cell using an edit control or widget.

OnCellErrorStateChanged

Occurs when the cell error state is added or removed.

OnCellFocusChanged

Occurs after the cell focus changes.

OnDoubleClick

Occurs when the user double-clicks on the cell.

OnEntryRecordAdded

Occurs when a new entry record appears on the JS Grid control.

OnEntryRecordCommitted

Occurs when the record entry is committed; that is, when an entry record has successfully added to the JS Grid control table cache.

OnEntryRecordPropertyChanged

Occurs when an entry record’s property is changed. This includes all user and programmatic edits.

OnGridErrorStateChanged

Occurs when the grid goes from a state of having one or more errors to having no errors, or the reverse.

OnInitialChangesForChangeKeyComplete(changeKey)

Occurs the first time all changes associated with a given change key have been validated; that is, no asynchronous calls pending).

OnPropertyChanged

Occurs when a record’s property is changed, including all user and programmatic edits.

OnRecordChecked

Occurs when one or more records is checked or unchecked by using the record indicator check box.

OnRecordDeleted

Occurs when a record is deleted.

OnRecordInserted

Occurs when a record is inserted.

OnRightClick

Occurs when the user right-clicks the cell.

OnRowErrorStateChanged

Occurs when the error state of a row changes.

OnRowFocusChanged

Occurs when the row focus changes.

OnSingleCellClick

Occurs when the user single clicks in a cell.

OnSingleCellKeyDown

Occurs when a single key is pressed.

OnVacateChange

Occurs when the grid is no longer tracking a specified change.

Attaching to Events

This example shows how to attach custom code to the OnCellEditComplete event.

<script type="text/javascript">
    Type.registerNamespace("GridManager");

    GridManager = function () {
        this.Init = function (jsGridControl, initialData, props) {
            control = jsGridControl;
            var dataSource = new SP.JsGrid.StaticDataSource(initialData);
            var jsGridParams = dataSource.InitJsGridParams();

            // This event is triggered after the standard grid error checking
            jsGridControl.AttachEvent(SP.JsGrid.EventType.OnCellEditCompleted, GotHere);

            jsGridControl.Init(jsGridParams);
        }
    };
    function GotHere(obj) {
        alert('Got here, ' + obj.fieldKey);

    }
</script>

Microsoft.SharePoint.JSGrid

JS Grid Control Delegates

See Also

Reference

Microsoft.SharePoint.JSGrid

JSGrid

Concepts

JS Grid Enumeration

Other Resources

JS Grid Control

JS Grid Control Functions