base
"table"
String
caption-top
false
Boolean
true
display caption on the topdefinition
undefined
Array
array
of objects
that defines look and behavior of the table. See details below.empty-filtered-text
"No records for current filter"
String
empty-text
"Empty table"
String
filter
empty string
String
RegExp
items (required)
undefined
Array
array
is an object
. Single object
is one record (row) of the dataitems-per-page
0
Number
0
disables paginationlocale
"en-GB"
String
mod-caption
empty string
String
mod-cell
empty string
String
mod-header-cell
empty string
String
mod-header-row
empty string
String
mod-row
empty string
String
mod-table
empty string
String
name
empty string
String
no-header
false
Boolean
true
does not display table headerspage
1
Number
primary-key (required)
undefined
String
key
attributeselection-mode
empty string
String
'single'
(allows selection of single row only), 'multiple'
(allows multiple rows to be selected) or empty string
(disables selection). After new row is selected or unselected the input:selection event is emmited with an array of all selected records. Filtering, sorting, changing current page or modifying selection-mode prop resets current selection by emmiting an empty arraystate
empty string
String
'busy'
or empty string
. Busy state disables pointer events on the table and renders contents of the busy
slot instead of table rowsvariant
empty string
String
mod-*
propsupdate:page
update:filtered-count
input:selection
caption
caption-top
propbusy
busy
stateempty-table-message
items
prop is empty tableempty-filtered-table-message
cell:[key]
value
, item
colspan
Table definition is an optional array
of objects
that defines columns of the table. Each object represents one column, has one required, unique key
property and number of options that define properties of the column. key
can be the name of the property of the record or a different key that will add empty column. Content of these columns can be set in named slot or using definition function.
If definition is not provided component makes one using the first record of the data. All additional properties are set to default values. This may be enough for simple tables however to use features like sorting, filtering etc you need to provide definition array.
let definition: ref([
{
key: "id",
visible: false,
},
{
key: "first_name",
sortable: true,
},
{
key: "last_name",
sortable: true,
},
{
key: "email",
sortable: true,
},
{
key: "city",
sortable: true,
},
{
key: "country",
sortable: true,
class: (k, v) => (v == "ID" ? "bg-red-50" : ""),
},
{
key: "edit",
},
])
Each column is defined by object with following properties:
key (required)
undefined
String
key
is one of the properties of data from items
prop or a new key
. New keys
apear as additional columns and their content can be set using slot or function f
. This property is required.label
undefined
String
key
converted to Header Casesortable
false
Boolean
strings
and using locale
prop to compare values. Numbers and dates are sorted as numbers and dates. null
, undefined
and NaN
values are always first when sorting in ascending directionfilterable
true
Boolean
update:filtered-count
is emmited (event data contains number of elements after filtering), event update:page
is emmited with value 1
(to reset pagination back to first page) and current selection is cleared by emmiting input:selection
event with an empty arrayvisible
true
Boolean
class
undefined
Function
key
, value
and item
f
undefined
Function
key
, value
and item
. This function cannot be used to add html to cell contentfilterByFunction
true
Boolean
true
filter content of column using value from function f
sortByFunction
true
Boolean
true
sort content of column using value returned from function f
Id | First Name | Last Name | City | Department | Title |
---|---|---|---|---|---|
1 | Anthony | Linbohm | Makui | Business Development | Quality Engineer |
2 | Richard | Moult | Xihu | Legal | Budget/Accounting Analyst IV |
3 | Chance | Dallas | Moncton | Support | Product Engineer |
4 | Rozamond | Abbatucci | Chico | Legal | Software Consultant |
5 | Ashely | Petrozzi | Lafia | Services | Staff Accountant III |
Status | First Name | Last Name | Department | Title | City | Edit |
---|---|---|---|---|---|---|
Pennie | Bysouth | Sales | Sales Representative | Lopatyn | ||
Tabitha | McIlwain | Marketing | Accountant I | Châtellerault | ||
Haily | Springford | Sales | Quality Control Specialist | Shahrak | ||
Jorgan | Gideon | Accounting | Environmental Specialist | Kantyshevo | ||
Bevan | Soeiro | Support | Human Resources Manager | Blagoveshchensk |
Item can have special property colspan: {}
. Properties of this object are rendered as full row below item. To render them use colspan
slot.
Id | First Name | Last Name | City | Department | Title |
---|---|---|---|---|---|
1 | Anthony | Linbohm | Makui | Business Development | Quality Engineer |
First name: Anthony City: Makui | |||||
2 | Richard | Moult | Xihu | Legal | Budget/Accounting Analyst IV |
First name: Richard City: Xihu | |||||
3 | Chance | Dallas | Moncton | Support | Product Engineer |
First name: Chance City: Moncton | |||||
4 | Rozamond | Abbatucci | Chico | Legal | Software Consultant |
First name: Rozamond City: Chico | |||||
5 | Ashely | Petrozzi | Lafia | Services | Staff Accountant III |
First name: Ashely City: Lafia |