Sheet
Description
The Sheet is the document that the user is viewing. It defines which rows and columns from the DataStore are visible in the grid.
Usage
Your DataGridXL instance contains a property sheet.
// create DataGridXL instance
const grid = new DataGridXL(...);
// work with the Sheet instance
grid.sheet.getColIdByIndex(3);
grid.sheet.events.on('changedocument', ...);NOTE: You don't need to create a Sheet instance yourself — it is provided by the grid automatically.Methods
deleteCols(ids)Delete columns by their IDs
Arguments
ColId[]Array of column idsdeleteRows(ids)Delete rows by their IDs
Arguments
RowId[]Array of row idsgetCellRangeData(cellRange): arrayGet cell range data as 2D array
Arguments
CellRangeCell range to get data fromarraydatagetCellRangeText(cellRange): stringGet cell range data as TSV
Arguments
CellRangeCell range to get text fromstringdata as TSVgetColCoordById(colId): ColCoordGet column coordinate by column ID
Arguments
ColIdColumn IDColCoordColumn coordinategetColCoordList(): ColId[]Get list of IDs according to coordinates
ColId[]Array of column IDsgetColHeaderText(id): stringThe text to appear in column header
Arguments
ColIdColumn IDstringText inside column headergetColIdByCoord(colCoord): ColIdGet column ID by column coordinate
Arguments
ColCoordColumn CoordinateColIdColumn IDgetColIdByIndex(colIndex): ColIdGet column ID by column index
Arguments
ColIndexColumn IndexColIdColumn IDgetColIdFromCellRange(cellRange): ColId[]Get column IDs from cell range
Arguments
CellRangeCell range to get column IDs fromColId[]Array of column IDsgetColIdsFromState()Get column ids from state
getColIndexByCoord(coord): ColIndexGet column index by column coordinate
Arguments
ColCoordColumn CoordinateColIndexColumn IndexgetColIndexById(colId): ColIndexGet column index by column ID
Arguments
ColIdColumn IDColIndexColumn IndexgetCoordBounds(): objectGet coordinate bounds {top, right, bottom, left}
objectCoordinate boundariesgetCoordGroupsFromColIds(colIds): arrayGet coord groups from col IDs
Arguments
RowId[]Column IDsarrayCoord GroupsgetCoordGroupsFromRowIds(rowIds): arrayGet coord groups from row IDs
Arguments
RowId[]Row IDsarrayCoord GroupsgetIdsFromCols(cols): ColId[]Get column IDs from cols
Arguments
ColsColId[]Array of column IDsgetIdsFromRows(rows): RowId[]Get row IDs from rows
Arguments
RowsRowId[]Array of row IDsgetLastColCoord(): ColCoordGet last column coordinate
ColCoordColumn CoordinategetLastColIndex(): ColIndexGet last column index
ColIndexColumn IndexgetLastRowCoord(): RowCoordGet last row coordinate
RowCoordRow CoordinategetLastRowIndex(): RowIndexGet last row index
RowIndexRow IndexgetRowCoordById(rowId): RowCoordGet row coordinate by row ID
Arguments
RowIdRow IDRowCoordRow coordinategetRowCoordList(): RowId[]Get list of IDs according to coordinates
RowId[]Array of row IDsgetRowHeaderText(id): stringThe text to appear in row header
Arguments
RowIdRow IDstringText inside row headergetRowIdByCoord(rowCoord): RowIdGet row ID by row coordinate
Arguments
RowCoordRow coordinateRowIdRow IDgetRowIdByIndex(rowIndex): RowIdGet row ID by row index
Arguments
RowIndexRow IndexRowIdRow IDgetRowIdsFromCellRange(cellRange): array<RowId>[todo] Get row IDs from cell range
Arguments
CellRangeCell range to get row IDs fromarray<RowId>Array of row IDsgetRowIndexByCoord(coord): RowIndexGet row index by row coordinate
Arguments
RowCoordRow CoordinateRowIndexRow IndexgetRowIndexById(rowId): RowIndexGet row index by row ID
Arguments
RowIdRow IDRowIndexRow IndexgetSortState(): arrayarrayCurrent sort statehideCols(ids)Hide columns by their IDs
Arguments
ColId[]Array of column IDshideRows(ids)Hide rows by their IDs
Arguments
RowId[]Array of row IDsinsertCols(ids, targetId?)Insert Columns
Arguments
ColIdColCoordIf left out, columns will be inserted at the startinsertColsUsingInstructions(insertInstructions)Insert columns using instructions
Arguments
arrayupdateinsertRows(ids, targetId?)Insert Rows
Arguments
RowId[]RowCoordIf left out, rows will be inserted at the startinsertRowsUsingInstructions(insertInstructions)Insert Rows using instructions
Arguments
arrayupdateisSortStateActive()Is sort state active
isViewStateActive()is view state active
moveColsUsingInstructions(moveInstructions)Move columns using instructions
Arguments
arrayupdatemoveRowsUsingInstructions(moveInstructions)Move rows using instructions
Arguments
arrayupdatesetSectionDividerX(id)Sets section divider X (freeze columns)
Arguments
ColIdColumn ID to freeze aftersetSectionDividerY(id)Sets section divider Y (freeze rows)
Arguments
RowIdRow ID to freeze aftersetSortState(sortState)Set sort state
Arguments
arrayshowCols(ids)Show columns
Arguments
ColId[]Column IDsshowRows(ids)Show Rows
Arguments
RowId[]Row IDssortUsingInstructions(rowIds, sortInstructions)Sort using instructions
Arguments
RowId[]Row IDsarraySort instructionsupdate(actionDetails)Call to trigger $update event
Arguments
object$updateEvents
changesortstateSheetSortStateChangeEventFires when sort state has changed
Payload
typestringpayloadSheetSortStateChangeEventPayloadtargetSheetupdateSheetUpdateEventFires when document has changed
Payload
typestringpayloadSheetUpdateEventPayloadtargetSheet