Function findRowIndexAtY

  • The row at a content position (y in px from the top of all body rows): constant row heights are computed directly, variable ones by a binary search over the row tops. Positions above / below the rows give the first / last row.

    Parameters

    • contentY: number

      y in content pixels

    • rowCount: number

      number of rows (> 0)

    • getYPosByRowIndex: ((rowIndex) => number)

      top of a row in content pixels (AreaModelIf.getYPosByRowIndex)

        • (rowIndex): number
        • Parameters

          • rowIndex: number

          Returns number

    • Optional constantRowHeight: number

      the height of every row, if they are all equal (AreaModelIf.getConstantRowHeight)

    Returns number

    the row index, 0 … rowCount - 1

    Example

    const body = tableModel.getBodyModel();
    const rowIndex = findRowIndexAtY(1234, body.getRowCount(), i => body.getYPosByRowIndex(i), body.getConstantRowHeight?.());

    Since

    1.1.95