Easily search and filter data in Vue3.
npm install vue-screener``bash`
npm install vue-screeneror
yarn add vue-screener
`vue
`
Control the state externally using the useVueScreener hook:
`vue
`
You can also configure options directly through VueScreener component props:
`vue`
contentHeight="400px"
:defaultCurrentPage="1"
:defaultRowsPerPage="10"
defaultSortField="id"
defaultSortDirection="desc"
:columns="{
id: { width: '50px', order: 0 },
name: { width: '150px', order: 1 }
}"
:disableSearchHighlight="false"
:loading="false"
title="My Table"
/>
You can customize the appearance and layout by composing your own table using individual components. Here's an example:
`vue
:key="column.field"
:screener="screener"
:column="column"
class="custom-header"
/>
:key="row.id"
class="custom-row"
>
:key="column.field"
:screener="screener"
:column="column"
:row="row"
class="custom-cell"
/>
`
* contentHeight: String - CSS height value for fixed height with scroll (optional)defaultCurrentPage
* : Number (default: 1)defaultRowsPerPage
* : Number (default: 10)defaultSortField
* : StringdefaultSortDirection
* : 'asc' | 'desc'columns
* : Column configuration objectdisableSearchHighlight
* : Boolean (default: false)loading
* : Boolean (default: false)
* data: Array of data (optional)screener
* : VueScreener state from useVueScreener (optional)class
* : String (optional)contentHeight
* : String - CSS height value for fixed height with scroll (optional)defaultCurrentPage
* : Number (default: 1)defaultRowsPerPage
* : Number (default: 10)defaultSortField
* : StringdefaultSortDirection
* : 'asc' | 'desc'columns
* : Column configuration objectdisableSearchHighlight
* : Boolean (default: false)loading
* : Boolean (default: false)title
* : String (optional)
`ts`
interface Column {
width?: string | number
label?: string
order?: number
isPinned?: boolean
isSortable?: boolean
hidden?: boolean
format?: (value: any, row: Row) => string
}
You can update options after initialization via the props or using the setOptions action:
`ts``
screener.actions.setOptions({
contentHeight: '600px',
disableSearchHighlight: true,
loading: true
})
MIT