Skip to content

Commit

Permalink
Use page_length to define how many rows to show
Browse files Browse the repository at this point in the history
  • Loading branch information
aleDsz committed Dec 13, 2022
1 parent cf87d9d commit ead20a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions assets/data_table/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ function App({ ctx, data }) {
const height = totalRows >= 10 && infiniteScroll ? 440 + headerHeight : null;
const rowMarkerStartIndex = (content.page - 1) * content.limit + 1;
const minColumnWidth = hasSummaries ? 150 : 50;

const rows =
content.page === content.max_page && !infiniteScroll
? totalRows % content.limit
: content.limit;
const rows = content.page_length;

const drawHeader = useCallback((args) => {
const {
Expand Down
1 change: 1 addition & 0 deletions lib/kino/table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ defmodule Kino.Table do
rows: rows,
columns: columns,
page: ctx.assigns.page,
page_length: length(rows),
max_page: total_rows && ceil(total_rows / ctx.assigns.limit),
total_rows: total_rows,
order: ctx.assigns.order,
Expand Down

0 comments on commit ead20a7

Please sign in to comment.