Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private selectedRegionTransform = (region: IRegion) => {
// convert cell selection to row selection
if (Regions.getRegionCardinality(region) === RegionCardinality.CELLS) {
return Regions.row(region.rows[0], region.rows[1]);
}
return region;
};
}
ReactDOM.render(
getTableComponent(
200,
100 * 1000,
{},
{
enableGhostCells: true,
selectionModes: SelectionModes.ALL,
},
),
document.getElementById("table-big"),
);
class RowSelectableTable extends React.Component<{}, {}> {
public state = {
selectedRegions: [Regions.row(2)],
};
public render() {
return (
<div>
<table>
</table></div>
private handleScrollToButtonClick = () => {
const { scrollToRowIndex, scrollToColumnIndex, scrollToRegionType } = this.state;
let region: IRegion;
switch (scrollToRegionType) {
case RegionCardinality.CELLS:
region = Regions.cell(scrollToRowIndex, scrollToColumnIndex);
break;
case RegionCardinality.FULL_ROWS:
region = Regions.row(scrollToRowIndex);
break;
case RegionCardinality.FULL_COLUMNS:
region = Regions.column(scrollToColumnIndex);
break;
case RegionCardinality.FULL_TABLE:
region = Regions.table();
break;
default:
return;
}
this.tableInstance.scrollToRegion(region);
};