Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the number of hits by search? #340

Open
xpediteur opened this issue Nov 6, 2023 · 1 comment
Open

how to get the number of hits by search? #340

xpediteur opened this issue Nov 6, 2023 · 1 comment

Comments

@xpediteur
Copy link

Having a vue3-easy-data-table with search options. Now I want to display the number of hits by search. Which variable or array can I use for this to get the length of the array? I didn't find anything about this in the documentation. Thanks.

@ctissier
Copy link

ctissier commented Feb 29, 2024

I'm not sure what you meant by "hits", but if you are (were) looking for the number of results of a search, you can check the clientItemsLength property of the dataTable ref.

<script setup lang="ts">
    //...
    const productsDataTable = ref()
    const itemsCount = computed(() => productsDataTable.value?.clientItemsLength);
    //...
</script>

<template>
    <!-- ... -->
    Filtered/searched items count : {{ itemsCount }}
    <EasyDataTable ref="productsDataTable" ... />
    <!-- ... -->
</template>

If it helps, here is what I believe are all the exposed variables/properties :

currentPageFirstIndex
currentPageLastIndex
clientItemsLength
maxPaginationNumber
currentPaginationNumber
isLastPage
isFirstPage
nextPage
prevPage
updatePage
rowsPerPageOptions
rowsPerPageActiveOption
updateRowsPerPageActiveOption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants