handsontable
Version:
Handsontable is a JavaScript Data Grid available for React, Angular and Vue.
18 lines • 507 B
JavaScript
import { scrollWindowToCell } from "../utils.mjs";
/**
* Scroll strategy for changed the focus position of the selection.
*
* @param {Core} hot Handsontable instance.
* @returns {function(): function(CellCoords): void}
*/
export function focusScrollStrategy(hot) {
return cellCoords => {
hot.scrollViewportTo(cellCoords.toObject(), () => {
const {
row,
col
} = hot.getSelectedRangeLast().highlight;
scrollWindowToCell(hot.getCell(row, col, true));
});
};
}