Skip to content

Commit

Permalink
fix(DataTable): make header pagination position fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lukicenturi authored and kelsos committed Oct 8, 2024
1 parent 07dd0fe commit 2f22dba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
20 changes: 10 additions & 10 deletions src/components/tables/RuiDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -996,19 +996,19 @@ onMounted(() => {
{ [$style.outlined]: outlined },
]"
>
<RuiTablePagination
v-if="paginationData && !hideDefaultHeader"
v-model="paginationData"
:dense="dense"
:loading="loading"
:disable-per-page="disablePerPage"
data-cy="table-pagination"
@update:model-value="onPaginate()"
/>
<div
ref="tableScroller"
:class="$style.scroller"
>
<RuiTablePagination
v-if="paginationData && !hideDefaultHeader"
v-model="paginationData"
:dense="dense"
:loading="loading"
:disable-per-page="disablePerPage"
data-cy="table-pagination"
@update:model-value="onPaginate()"
/>
<table
ref="table"
:class="[$style.table, { [$style.dense]: dense }]"
Expand Down Expand Up @@ -1341,7 +1341,7 @@ onMounted(() => {
}
.table {
@apply min-w-full table-fixed divide-y divide-black/[0.12] whitespace-nowrap mx-auto my-0 max-w-fit relative border-t border-black/[0.12];
@apply min-w-full table-fixed divide-y divide-black/[0.12] whitespace-nowrap mx-auto my-0 max-w-fit relative border-black/[0.12];
.tbody {
@apply divide-y divide-black/[0.12];
Expand Down
18 changes: 11 additions & 7 deletions src/components/tables/RuiTablePagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function onLast() {
</script>

<template>
<div :class="$style.wrapper">
<div :class="[$style.wrapper, { [$style['wrapper-dense']]: dense }]">
<div :class="$style.limit">
<span :class="$style.limit__text">Rows per page:</span>
<RuiMenuSelect
Expand Down Expand Up @@ -201,21 +201,21 @@ function onLast() {

<style module lang="scss">
.wrapper {
@apply relative flex flex-wrap items-center justify-end;
@apply relative flex flex-wrap items-center justify-end gap-x-4 gap-y-0;
.limit {
@apply flex items-center space-x-2 text-caption px-3;
@apply flex items-center space-x-2 text-caption;
&__text {
@apply text-rui-text-secondary whitespace-nowrap py-4;
@apply text-rui-text-secondary whitespace-nowrap py-3;
}
}
.ranges {
@apply flex items-center space-x-2 text-caption px-3;
@apply flex items-center space-x-2 text-caption pr-2;
&__text {
@apply text-rui-text-secondary whitespace-nowrap py-4;
@apply text-rui-text-secondary whitespace-nowrap py-3;
}
}
Expand All @@ -224,7 +224,11 @@ function onLast() {
}
.navigation {
@apply flex items-center pl-3;
@apply flex items-center;
}
&-dense {
@apply gap-x-2;
}
}
</style>

0 comments on commit 2f22dba

Please sign in to comment.