diff --git a/tslib/react/src/components/DataGrid.tsx b/tslib/react/src/components/DataGrid.tsx index b268ee81..4462768b 100644 --- a/tslib/react/src/components/DataGrid.tsx +++ b/tslib/react/src/components/DataGrid.tsx @@ -119,17 +119,23 @@ function FilterMenu({ function DataGrid({ data, columns, + initialRowsPerPage, }: { data: T[] columns: ColumnDef[] + initialRowsPerPage?: number }): React.ReactElement { const [sorting, setSorting] = React.useState([]) const [columnFilters, setColumnFilters] = React.useState( [] ) + const rowsPerPageOptions = [10, 50, 100, { label: "All", value: data.length }] const [pagination, setPagination] = React.useState({ pageIndex: 0, - pageSize: 50, + pageSize: + initialRowsPerPage && rowsPerPageOptions.includes(initialRowsPerPage) + ? initialRowsPerPage + : 50, }) const table = useReactTable({ @@ -236,12 +242,7 @@ function DataGrid({ = ( export const TrialTable: FC<{ study: Optuna.Study -}> = ({ study }) => { + initialRowsPerPage?: number +}> = ({ study, initialRowsPerPage }) => { const trials: Optuna.Trial[] = study.trials const columnHelper = createColumnHelper() @@ -99,5 +100,11 @@ export const TrialTable: FC<{ } } - return + return ( + + ) }