3333 :body-item-class-name =" bodyItemClassNameFunction"
3434 @click-row =" showItem"
3535 @update-sort =" updateSort"
36+ hide-footer
3637 >
3738
3839 <template #expand =" item " >
6162 </DataTable >
6263
6364 <div class =" customize-footer" >
65+ <div class =" customize-rows-per-page" >
66+ <select
67+ class =" select-items"
68+ @change =" updateRowsPerPageSelect"
69+ >
70+ <option
71+ v-for =" item in rowsPerPageOptions"
72+ :key =" item"
73+ :selected =" item === rowsPerPageActiveOption"
74+ :value =" item"
75+ >
76+ {{ item }} rows per page
77+ </option >
78+ </select >
79+ </div >
6480 <div class =" customize-index" >
6581 Now displaying: {{ currentPageFirstIndex }} ~ {{ currentPageLastIndex }} of {{ totalItemsLength }}
6682 </div >
98114import {
99115 computed , ref , reactive , toRefs ,
100116} from ' vue' ;
117+ // import { useRowsPerPage } from 'use-vue3-easy-data-table';
118+ // import type { UseRowsPerPageReturn } from 'use-vue3-easy-data-table';
101119import type {
102120 Header , Item , FilterOption , ClickRowArgument , UpdateSortArgument , HeaderItemClassNameFunction , BodyItemClassNameFunction , BodyRowClassNameFunction ,
103121} from ' ../types/main' ;
104122import DataTable from ' ../components/DataTable.vue' ;
105123import { mockClientNestedItems , mockClientItems , mockDuplicateClientNestedItems } from ' ../mock' ;
106124
125+
107126const searchField = ref (' name' );
108127const searchValue = ref (' ' );
109128
@@ -191,6 +210,7 @@ const dataTable = ref();
191210// index related
192211const currentPageFirstIndex = computed (() => dataTable .value ?.currentPageFirstIndex );
193212const currentPageLastIndex = computed (() => dataTable .value ?.currentPageLastIndex );
213+
194214const totalItemsLength = computed (() => dataTable .value ?.totalItemsLength );
195215
196216// paginations related
@@ -206,9 +226,24 @@ const nextPage = () => {
206226const prevPage = () => {
207227 dataTable .value .prevPage ();
208228};
209- const updatePage = (paginationNumber : number ) => {
210- dataTable .value .updatePage (paginationNumber );
229+
230+ // rows per page
231+ const rowsPerPageOptions = computed (() => dataTable .value ?.rowsPerPageOptions );
232+ const rowsPerPageActiveOption = computed (() => dataTable .value ?.rowsPerPageActiveOption );
233+
234+ const updateRowsPerPageSelect = (e : Event ) => {
235+ dataTable .value .updateRowsPerPageActiveOption (Number ((e .target as HTMLInputElement ).value ));
211236};
237+
238+ // const {
239+ // rowsPerPageOptions,
240+ // rowsPerPageActiveOption,
241+ // updateRowsPerPageActiveOption,
242+ // }: UseRowsPerPageReturn = useRowsPerPage(dataTable);
243+
244+ // const updateRowsPerPageSelect = (e: Event) => {
245+ // updateRowsPerPageActiveOption(Number((e.target as HTMLInputElement).value));
246+ // };
212247 </script >
213248
214249<style scoped>
0 commit comments