File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 63
63
</tr >
64
64
</tbody >
65
65
</table >
66
- <div v-if =" hasPrev || hasNext" class =" border-t p-3 justify-end flex" >
66
+ <div v-if =" items.length > 10" class =" border-t p-3 justify-end flex gap-3" >
67
+ <div class =" flex items-center" >Rows per page</div >
68
+ <select v-model.number =" pagination.rowsPerPage" class =" select select-sm select-primary" >
69
+ <option :value =" 10" >10</option >
70
+ <option :value =" 25" >25</option >
71
+ <option :value =" 50" >50</option >
72
+ <option :value =" 100" >100</option >
73
+ </select >
67
74
<div class =" btn-group" >
68
75
<button :disabled =" !hasPrev" class =" btn btn-sm" @click =" prev()" >«</button >
69
76
<button class =" btn btn-sm" >Page {{ pagination.page }}</button >
97
104
] as TableHeader [];
98
105
});
99
106
107
+ const preferences = useViewPreferences ();
108
+
100
109
const pagination = reactive ({
101
110
descending: false ,
102
111
page: 1 ,
103
- rowsPerPage: 10 ,
112
+ rowsPerPage: preferences . value . itemsPerTablePage ,
104
113
rowsNumber: 0 ,
105
114
});
106
115
116
+ watch (
117
+ () => pagination .rowsPerPage ,
118
+ newRowsPerPage => {
119
+ preferences .value .itemsPerTablePage = newRowsPerPage ;
120
+ }
121
+ );
122
+
107
123
const next = () => pagination .page ++ ;
108
124
const hasNext = computed <boolean >(() => {
109
125
return pagination .page * pagination .rowsPerPage < props .items .length ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export type LocationViewPreferences = {
9
9
editorAdvancedView : boolean ;
10
10
itemDisplayView : ViewType ;
11
11
theme : DaisyTheme ;
12
+ itemsPerTablePage : number ;
12
13
} ;
13
14
14
15
/**
@@ -24,6 +25,7 @@ export function useViewPreferences(): Ref<LocationViewPreferences> {
24
25
editorAdvancedView : false ,
25
26
itemDisplayView : "card" ,
26
27
theme : "homebox" ,
28
+ itemsPerTablePage : 10 ,
27
29
} ,
28
30
{ mergeDefaults : true }
29
31
) ;
You can’t perform that action at this time.
0 commit comments