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
@@ -209,6 +229,24 @@ const prevPage = () => {
209229const updatePage = (paginationNumber : number ) => {
210230 dataTable .value .updatePage (paginationNumber );
211231};
232+
233+ // rows per page
234+ const rowsPerPageOptions = computed (() => dataTable .value ?.rowsPerPageOptions );
235+ const rowsPerPageActiveOption = computed (() => dataTable .value ?.rowsPerPageActiveOption );
236+
237+ const updateRowsPerPageSelect = (e : Event ) => {
238+ dataTable .value .updateRowsPerPageActiveOption (Number ((e .target as HTMLInputElement ).value ));
239+ };
240+
241+ // const {
242+ // rowsPerPageOptions,
243+ // rowsPerPageActiveOption,
244+ // updateRowsPerPageActiveOption,
245+ // }: UseRowsPerPageReturn = useRowsPerPage(dataTable);
246+
247+ // const updateRowsPerPageSelect = (e: Event) => {
248+ // updateRowsPerPageActiveOption(Number((e.target as HTMLInputElement).value));
249+ // };
212250 </script >
213251
214252<style scoped>
0 commit comments