The v-data-table component is used for displaying tabular data. Features include sorting, searching, pagination, inline-editing, and row selection.

The standard data-table will by default render your data as simple rows.

제공되는 Props, Slots, Events 와 함수들을 이용하여 원하는 컴포넌트를 직접 구현해 보세요.

간단한 예재부터 복잡한 예제까지 아래를 참고해서 앱 개발을 시작해 보세요.

The show-select prop will render a checkbox in the default header to toggle all rows, and a checkbox for each default row. You can customize these with the slots and respectively. You can also switch between allowing multiple selected rows at the same time or just one with the single-select prop.

Using the group-by and group-desc props you can group rows on an item property. The show-group-by prop will show a group button in the default header.

Using the multi-sort prop will enable you to sort on multiple columns at the same time. When enabled, you can pass arrays to both sort-by and sort-desc to programmatically control the sorting, instead of single values.

You can use the loading prop to indicate that data in the table is currently loading. If there is no data in the table, a loading message will also be displayed. This message can be customized using the loading-text prop or the loading slot.

Using the dense prop you are able to give your data tables an alternate style.

You can easily disable specific columns from being included when searching through table rows by setting the property filterable to false on the header item(s). In the example below the dessert name column is no longer searchable.

The v-data-table provides a large number of slots for customizing the table. This example showcases some of these slots and what you can do with each. It is important to note some slot (eg: item/body/header) will completely takes over the internal rendering of the component which will require you to re-implement functionalities such as selection and expansion. Some slots will override each other such as: body > item > item.<name> and header/header.<name>.

When wanting to use a checkbox component inside of a slot template in your data tables, use the v-simple-checkbox component rather than the v-checkbox component. The v-simple-checkbox component is used internally and will respect header alignment.

The show-expand prop will render an expand icon on each default row. You can customize this with the slot. The position of this slot can be customized by adding a column with value: 'data-table-expand' to the headers array. You can also switch between allowing multiple expanded rows at the same time or just one with the single-expand prop. The expanded rows are available on the synced prop expanded.sync

You can override the default filtering used with search prop by supplying a function to the custom-filter prop. If you need to customize the filtering of a specific column, you can supply a function to the filter property on header items. The signature is (value: any, search: string | null, item: any) => boolean. This function will always be run even if search prop has not been provided. Thus you need to make sure to exit early with a value of true if filter should not be applied.

You can use the dynamic slots header.<name> to customize only certain columns. <name> is the name of the value property in the corresponding header item sent to headers.

You can use the dynamic slots item.<name> to customize only certain columns. <name> is the name of the value property in the corresponding header item sent to headers. So to customize the calories column we're using the item.calories slot.

페이지네이션(Pagination)은 pagination prop을 통해 외부에서 제어될 수 있습니다. .sync 수식어(modifier)를 반드시 사용해야 합니다.

정렬 또한 pagenation prop을 통해 외부에서 제어될 수 있습니다. .sync 수식어(modifier)를 반드시 사용해야 한다는 것을 기억하세요. pagenation prop으로 또한 기본 정렬 열(default sorted column) 을 정할 수도 있습니다.

If you're loading data already paginated and sorted from a backend, you can use the server-items-length prop. Defining this prop will disable the built-in sorting and pagination, and you will instead need to use the available events (update:page, update:sortBy, update:options, etc) to know when to request new pages from your backend. Use the loading prop to display a progress bar while fetching data.

The v-edit-dialog component can be used for editing data directly within a v-data-table. You can block the closing of the v-edit-dialog when clicked outside by adding the persistent prop.

데이터 테이블에서 v-dialog 컴포넌트를 이용해 각 행을 편집하는 방식의 CRUD 액션입니다. (data-table with CRUD actions using a v-dialog component for editing each row)

더 읽을 준비 되었나요? 그렇다면 아래 설명서를 더 읽어보세요!

Caught a mistake or want to contribute to the documentation? Edit Layout on GitHub!