Fix/add footer row to AutoTable
This commit is contained in:
@@ -3944,7 +3944,11 @@ export function AutoTable(props: AutoTableProps) {
|
|||||||
<For each={displayData()}>
|
<For each={displayData()}>
|
||||||
{(item, rowIdx) => {
|
{(item, rowIdx) => {
|
||||||
const position = () => (displayPagination().CurrentPage - 1) * displayPagination().MaxItemsPerPage + rowIdx() + 1;
|
const position = () => (displayPagination().CurrentPage - 1) * displayPagination().MaxItemsPerPage + rowIdx() + 1;
|
||||||
const isLastRow = () => rowIdx() === displayData().length - 1;
|
// A footer row is appended after the data rows in the same
|
||||||
|
// <tbody> (see props.footer below), so the final data row
|
||||||
|
// isn't visually last when one is present — it still needs
|
||||||
|
// its border-b to separate it from the footer.
|
||||||
|
const isLastRow = () => rowIdx() === displayData().length - 1 && !props.footer;
|
||||||
const rowKey = () => item.id ?? rowIdx();
|
const rowKey = () => item.id ?? rowIdx();
|
||||||
const isExpanded = () => opts().accordion && expandedRows().has(rowKey());
|
const isExpanded = () => opts().accordion && expandedRows().has(rowKey());
|
||||||
const isHighlighted = () => !!(props.highlightMatch && props.highlightMatch(item));
|
const isHighlighted = () => !!(props.highlightMatch && props.highlightMatch(item));
|
||||||
@@ -3996,7 +4000,7 @@ export function AutoTable(props: AutoTableProps) {
|
|||||||
];
|
];
|
||||||
}}
|
}}
|
||||||
</For>
|
</For>
|
||||||
<Show when={props.footer}><tr>{props.footer}</tr></Show>
|
<Show when={props.footer}>{props.footer}</Show>
|
||||||
</Show>
|
</Show>
|
||||||
</tbody>
|
</tbody>
|
||||||
<Show when={opts().summaryRows && userSummaryRows().length > 0}>
|
<Show when={opts().summaryRows && userSummaryRows().length > 0}>
|
||||||
|
|||||||
Reference in New Issue
Block a user