Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for lazy data frames #283

Merged
merged 1 commit into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions assets/data_table/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function App({ ctx, data }) {
const fixedHeight = 440 + headerHeight;
const minRowsToFitMenu = hasSorting ? 3 : 2;
const autoHeight =
totalRows < minRowsToFitMenu && menu ? menuHeight + headerHeight : null;
totalRows && totalRows < minRowsToFitMenu && menu ? menuHeight + headerHeight : null;
const height = totalRows >= 10 && infiniteScroll ? fixedHeight : autoHeight;
const rowMarkerStartIndex = (content.page - 1) * content.limit + 1;
const minColumnWidth = hasSummaries ? 150 : 50;
Expand Down Expand Up @@ -474,6 +474,7 @@ function App({ ctx, data }) {
maxPage={content.max_page}
onPrev={onPrev}
onNext={onNext}
rows={rows}
/>
)}
</div>
Expand Down Expand Up @@ -566,14 +567,14 @@ function LimitSelect({ limit, totalRows, onChange }) {
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
<option value={totalRows}>All</option>
{totalRows ? <option value={totalRows}>All</option> : null}
</select>
</form>
</div>
);
}

function Pagination({ page, maxPage, onPrev, onNext }) {
function Pagination({ page, maxPage, onPrev, onNext, rows }) {
return (
<div className="pagination">
<button
Expand All @@ -592,7 +593,7 @@ function Pagination({ page, maxPage, onPrev, onNext }) {
<button
className="pagination__button"
onClick={onNext}
disabled={page === maxPage}
disabled={page === maxPage || rows === 0}
>
<span>Next</span>
<RiArrowRightSLine />
Expand Down
Loading