[]
        
(Showing Draft Content)

GridPanel Class

GridPanel Class

Represents a logical part of the grid, such as the column headers, row headers, and scrollable data part.

Heirarchy

Constructors

constructor

  • Initializes a new instance of the GridPanel class.

    Parameters

    • g: FlexGrid

      The FlexGrid object that owns the panel.

    • cellType: CellType

      The type of cell in the panel.

    • rows: RowCollection

      The rows displayed in the panel.

    • cols: ColumnCollection

      The columns displayed in the panel.

    • host: HTMLElement

      The HTMLElement that hosts the cells in the control.

    Returns GridPanel

Properties

activeCell

activeCell: HTMLElement | null

Gets the active cell in this panel.

cellType

cellType: CellType

Gets the type of cell contained in the panel.

columns

Gets the panel's column collection.

grid

grid: FlexGrid

Gets the grid that owns the panel.

height

height: number

Gets the total height of the content in this panel.

hostElement

hostElement: HTMLElement

Gets the host element for the panel.

rows

Gets the panel's row collection.

viewRange

viewRange: CellRange

Gets a CellRange that indicates the range of cells currently visible on the panel.

width

width: number

Gets the total width of the content in the panel.

Methods

getCellBoundingRect

  • getCellBoundingRect(r: number, c: number | string, raw?: boolean): Rect
  • Gets a cell's bounds in viewport coordinates.

    The returned value is a Rect object which contains the position and dimensions of the cell in viewport coordinates. The viewport coordinates are the same as those used by the getBoundingClientRect method.

    Parameters

    • r: number

      The index of the row that contains the cell.

    • c: number | string

      The index, name, or binding of the column that contains the cell.

    • Optional raw: boolean

      Whether to return the rectangle in raw panel coordinates as opposed to viewport coordinates.

    Returns Rect

getCellData

  • getCellData(r: number, c: number | string, formatted: boolean): any
  • Gets the value stored in a cell in the panel.

    Parameters

    • r: number

      The row index of the cell.

    • c: number | string

      The index, name, or binding of the column that contains the cell.

    • formatted: boolean

      Whether to format the value for display.

    Returns any

getCellElement

  • getCellElement(r: number, c: number | string): HTMLElement
  • Gets the element that represents a cell within this GridPanel.

    If the cell is not currently in view, this method returns null.

    Parameters

    • r: number

      The index of the row that contains the cell.

    • c: number | string

      The index, name, or binding of the column that contains the cell.

    Returns HTMLElement

getLastVisibleColumn

  • getLastVisibleColumn(end?: number): number
  • Returns the last visible column present in the panel upto and including the end position. return -1 if no visible column is present

    Parameters

    • Optional end: number

      Last index of column to check.

    Returns number

getLastVisibleRow

  • getLastVisibleRow(end?: number): number
  • Returns the last visible row present in the panel upto and including the end position. return -1 if no visible row is present

    Parameters

    • Optional end: number

      Last index of row to check.

    Returns number

getNextVisibleColumn

  • getNextVisibleColumn(start?: number): number
  • Returns the next visible column present in the panel including the start position. return -1 if no visible column is present

    Parameters

    • Optional start: number

      Starting index of column.

    Returns number

getNextVisibleRow

  • getNextVisibleRow(start?: number): number
  • Returns the next visible row present in the panel including the start position. return -1 if no visible row is present

    Parameters

    • Optional start: number

      Starting index of row.

    Returns number

getSelectedState

  • Gets a SelectedState value that indicates the selected state of a cell.

    Parameters

    • r: number

      Row index of the cell to inspect.

    • c: number | string

      The index, name, or binding of the column that contains the cell.

    • Optional rng: CellRange

      CellRange that contains the cell to inspect.

    Returns SelectedState

isRangeValid

  • Checks whether a given CellRange is valid for this panel's row and column collections.

    Parameters

    Returns boolean

setCellData

  • setCellData(r: number, c: number | string, value: any, coerce?: boolean, invalidate?: boolean, isMapKeyValue?: boolean): boolean
  • Sets the content of a cell in the panel.

    Parameters

    • r: number

      The index of the row that contains the cell.

    • c: number | string

      The index, name, or binding of the column that contains the cell.

    • value: any

      The value to store in the cell.

    • Optional coerce: boolean

      Whether to change the value automatically to match the column's data type.

    • Optional invalidate: boolean

      Whether to invalidate the grid to show the change.

    • Optional isMapKeyValue: boolean

      value passed is already key value of dataMap, don't need re-find.

    Returns boolean

    Returns true if the value is stored successfully, false otherwise (failed cast).