Handling Events

var grid = new DataGridXL("grid", ...);

var colResizeHandler = function(gridEvent){ ... };
grid.events.on('colresize', colResizeHandler);
grid.events.off('colresize', colResizeHandler);

Actions: Any

documentchange

Document has changed. Fired after any column/row action that changes the document (insert, delete, move, resize). Use together with cellvaluechange to catch all changes to document (data). Use grid.getData() to get grid data.

since v1.20.06.29

Actions: Cell

_beforecellcolorchange experimental

Cell color(s) are about to be changed. Return false to prevent the event.

nametypedesc
rowIdsarrayIDs of affected rows
colIdsarrayIDs of affected columns
changeStore2d array2d array that holds new colors

_cellcolorchange experimental

Cell color(s) have changed.

nametypedesc
rowIdsarrayIDs of affected rows
colIdsarrayIDs of affected columns
changeStore2d array2d array that holds new colors

beforecellvaluechange

Cell value(s) are about to be changed. Return false to prevent the event.

nametypedesc
rowIdsarrayIDs of affected rows
colIdsarrayIDs of affected columns
changeStore2d array2d array that holds new values

cellvaluechange

Cell value(s) have changed. Use grid.getData() to get grid data.

nametypedesc
rowIdsarrayIDs of affected rows
colIdsarrayIDs of affected columns
changeStore2d array2d array that holds new values

Actions: Clipboard

beforecopy

Cell selection is about to be copied. Return false to prevent the event.

nametypedesc
textstringCopied values (Tab Seperated Values)
cellRangecellRangeCell range that was copied

copy

Cell selection has been copied.

nametypedesc
textstringCopied values (Tab Seperated Values)
cellRangecellRangeCell range that was copied

beforecut

Cell selection is about to be cut. Return false to prevent the event.

nametypedesc
textstringCopied values (Tab Seperated Values)
cellRangecellRangeCell range that was copied

cut

Cell selection has been cut.

nametypedesc
textstringCopied values (Tab Seperated Values)
cellRangecellRangeCell range that was copied

beforepaste

Clipboard data is about to be pasted. Return false to prevent the event.

nametypedesc
textstringclipboard data (Tab Seperated Values)

paste

Clipboard data has been pasted.

nametypedesc
textstringClipboard data (Tab Seperated Values)

Actions: Column

beforecoldelete

Column(s) are about to be deleted. Return false to prevent the event.

nametypedesc
colIdsarrayIDs of deleted columns

coldelete

Column(s) have been deleted.

nametypedesc
colIdsarrayIDs of deleted columns

beforecolinsert

Column(s) are about to be inserted. Return false to prevent the event.

nametypedesc
amountintNumber of inserted columns
targetIdcolIdID of column to insert new columns after. A targetId of 0 means that columns should be inserted at the very start.

colinsert

Column(s) have been inserted.

nametypedesc
amountintNumber of inserted columns
targetIdcolIdID of column to insert new columns after. A targetId of 0 means that columns should be inserted at the very start.
insertedIdsarrayArray of inserted column IDs

beforecolmove

Column(s) are about to be moved. Return false to prevent the event.

nametypedesc
colIdsarrayArray of moved column IDs
targetIdcolIdID of column to insert new column(s) after. A targetId of 0 means that column(s) should be inserted at the very start.

colmove

Column(s) have been moved.

nametypedesc
colIdsarrayArray of moved column IDs
targetIdcolIdID of column to insert new column(s) after. A targetId of 0 means that column(s) should be inserted at the very start.

beforecolresize

Column(s) are about to be resized. Return false to prevent the event.

nametypedesc
colIdsarrayIDs of resized columns
changeStorearrayArray that holds new widths

colresize

Column(s) have been resized.

nametypedesc
colIdsarrayIDs of resized columns
changeStorearrayArray that holds new widths

Actions: Row

beforerowdelete

Row(s) are about to be deleted. Return false to prevent the event.

nametypedesc
rowIdsarrayIDs of deleted rows

rowdelete

Row(s) have been deleted.

nametypedesc
rowIdsarrayIDs of deleted rows

beforerowinsert

Row(s) are about to be inserted.

nametypedesc
amountintNumber of inserted rows
targetIdrowIdID of row to insert new rows after. A targetId of 0 means that rows should be inserted at the very start.

rowinsert

Row(s) have been inserted.

nametypedesc
amountintNumber of inserted rows
targetIdrowIdID of row to insert new rows after. A targetId of 0 means that rows should be inserted at the very start.
insertedIdsarrayArray of inserted row IDs

beforerowmove

Row(s) are about to be moved. Return false to prevent the event.

nametypedesc
rowIdsarrayArray of moved row IDs
targetIdrowIdID of row to insert new row(s) after. A targetId of 0 means that row(s) should be inserted at the very start.

rowmove

Row(s) have been moved.

nametypedesc
rowIdsarrayArray of moved row IDs
targetIdrowIdID of row to insert new row(s) after. A targetId of 0 means that row(s) should be inserted at the very start.

Activation

activate

Grid is activated. Triggers when a selection has been made when there wasn't any. A bit like Javascript's focus event.

deactivate

Grid is deactivated. Triggers when grid "looses focus" (by clicking outside component or outside browser window). A bit like Javascript's blur event.

Container

containerresize

Dimensions of grid container have changed.

Context Menu

contextmenuclose

Context Menu has been closed.

nametypedesc
contextMenuobjectReference to contextMenu instance

contextmenuitemselect

Context Menu Item has been selected.

nametypedesc
contextMenuobjectReference to contextMenu instance
indexintIndex of selected context menu item
itemobjectSelected context menu item

beforecontextmenuopen

Context Menu is about to be opened. Return false to prevent the event.

nametypedesc
snapPointX;YintPixel coordinates that determine where contextMenu should be displayed
contextMenuobjectReference to contextMenu instance
itemsarrayContext menu items

contextmenuopen

Context Menu has been opened.

nametypedesc
snapPointX;YintPixel coordinates that determine where contextMenu should be displayed
contextMenuobjectReference to contextMenu instance
itemsarrayContext menu items

Context Menu (touch)

contextmenutouchclose

Context Menu (touch) has been closed.

nametypedesc
contextMenuTouchobjectReference to contextMenuTouch instance

contextmenutouchitemselect

Context Menu (touch) Item has been selected.

nametypedesc
contextMenuTouchobjectReference to contextMenuTouch instance
indexintIndex of selected context menu (touch) item
itemobjectSelected context menu (touch) item

beforecontextmenutouchopen

Context Menu (touch) is about to be opened. Return false to prevent the event.

nametypedesc
snapPointX;Y;Y2intPixel coordinates that determine where contextMenuTouch should be displayed
contextMenuTouchobjectReference to contextMenuTouch instance
itemsarrayContext menu (touch) items

contextmenutouchopen

Context Menu (touch) has opened.

nametypedesc
snapPointX;Y;Y2intPixel coordinates that determine where contextMenuTouch should be displayed
contextMenuTouchobjectReference to contextMenuTouch instance
itemsarrayContext menu (touch) items

Lifecycle

ready

Grid is rendered and ready for interaction.

Selection

cellcursorpositionchange

Cell cursor position has changed.

nametypedesc
cellCursorPositioncellCoordsCell cursor position in cell coordinates {x,y}

cellselectionchange

Cell selection has changed.

nametypedesc
cellSelectioncellRangeCell selection in cell range [{x,y},{x,y}]

Undo & Redo

beforeredo

Command is about to be redone. Return false to prevent the event.

redo

Command has been redone.

beforeundo

Command is about to be undone. Return false to prevent the event.

undo

Command has been undone.

Viewport

viewportpositionchange

Viewport position has changed.

nametypedesc
viewportPositioncellCoordsViewport position in cell coordinates {x,y}
1 active listener(s)