본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

DataTable (데이터 테이블)

원문 보기 위키 갱신

DataTable은 데이터를 표 형식으로 보여 주는 컴포넌트예요. 정렬, 필터, 페이지네이션, 선택, 행 그룹핑, 셀 편집 같은 데이터 그리드의 기본기를 모두 갖추고 있어요.

출처: 문서

본문

가져오기 (Import)

import DataTable from 'primevue/datatable';
import Column from 'primevue/column';
import ColumnGroup from 'primevue/columngroup'; // optional
import Row from 'primevue/row'; // optional

접근성 (Accessibility)

스크린 리더 DataTable은 table 엘리먼트를 사용하고, 이 엘리먼트의 속성은 tableProps 옵션으로 확장할 수 있어요. 이 속성으로 aria 역할과 aria-label, aria-describedby 같은 속성을 전달해 스크린 리더를 위한 테이블을 정의해요. 테이블의 기본 역할(role)은 table이에요. 헤더, 바디, 푸터 엘리먼트는 rowgroup을 사용하고, 행은 row 역할을, 헤더 셀은 columnheader, 바디 셀은 cell 역할을 사용해요. 정렬 가능한 헤더는 aria-sort 속성에 "ascending" 또는 "descending" 값을 사용해요.

행 선택을 위한 내장 checkbox와 radiobutton 컴포넌트는 checkbox와 radiobutton 역할을 사용해요. 이를 설명하는 레이블은 locale API의 aria.selectRow와 aria.unselectRow 프로퍼티에서 가져오고, 헤더 체크박스도 마찬가지로 selectAll과 unselectAll 키를 사용해요. 행이 선택되면 해당 행에 aria-selected가 true로 설정돼요.

행을 펼치거나 접는 엘리먼트는 aria-expanded와 aria-controls 속성을 가진 버튼이에요. 버튼을 설명하는 값은 locale API의 aria.expandRow와 aria.collapseRow 프로퍼티에서 파생돼요.

필터 메뉴 버튼은 aria-label로 aria.showFilterMenu와 aria.hideFilterMenu 프로퍼티를 사용하고, 버튼과 오버레이의 관계를 정의하려고 aria-haspopup, aria-expanded, aria-controls도 함께 사용해요. 팝업 메뉴는 포커스가 오버레이 안에 유지되므로 aria-modal과 함께 dialog 역할을 가져요. 연산자 드롭다운은 aria.filterOperator를, 필터 제약(constraint) 드롭다운은 aria.filterConstraint 프로퍼티를 사용해요. 규칙을 추가·제거하는 버튼은 aria.addRule과 aria.removeRule 프로퍼티를, 푸터 버튼도 마찬가지로 aria.clear와 aria.apply 프로퍼티를 사용해요. Column 컴포넌트의 filterInputProps로 내장 필터 컴포넌트의 aria 레이블을 정의할 수 있고, 템플릿으로 커스텀 컴포넌트를 쓴다면 직접 aria 레이블을 정의할 수도 있어요.

편집 가능한 셀은 커스텀 템플릿을 사용하기 때문에 필요하다면 aria 역할과 속성을 직접 관리해야 해요. 행 편집 컨트롤은 버튼 엘리먼트이며, aria-label로 aria.editRow, aria.cancelEdit, aria.saveEdit를 사용해요. 페이지네이터는 DataTable 안에서 사용되는 독립 컴포넌트라서, 접근성 기능에 대한 자세한 내용은 paginator 문서를 참고하세요.

키보드 지원 DataTable 안의 버튼 엘리먼트는 필터, 행 확장, 편집 같은 용도로 사용되며 모두 탭 가능하고 space와 enter 키로 조작할 수 있어요.

정렬 가능한 헤더의 키보드 지원은 이렇게 동작해요. tab은 헤더 사이를 이동하고, enter와 space는 해당 컬럼을 정렬해요.

필터 메뉴의 키보드 지원에서 tab은 팝업 안의 엘리먼트 사이를 이동하고, escape는 팝업을 숨겨요.

선택 키보드 지원은 이렇게 동작해요. tab은 첫 번째 선택된 행으로 포커스를 옮기고, 선택된 행이 없으면 첫 행이 포커스를 받아요. up arrow(위쪽 화살표)는 이전 행으로, down arrow는 다음 행으로 포커스를 옮겨요. enter와 space는 metaKeySelection 설정에 따라 포커스된 행의 선택 상태를 토글해요. home은 첫 행으로, end는 마지막 행으로 이동해요. shift + down arrow는 다음 행으로 포커스를 옮기면서 선택 상태를 토글하고, shift + up arrow는 이전 행으로 옮기면서 토글해요. shift + space는 가장 최근에 선택한 행과 포커스된 행 사이의 행들을 선택해요. control + shift + home은 포커스된 행부터 첫 행까지를, control + shift + end는 포커스된 행부터 마지막 행까지를 선택해요. control + a는 모든 행을 선택해요.

기본 (Basic)

DataTable은 표시할 데이터로 value가 필요하고, 화면 표현을 위해 자식으로 Column 컴포넌트들을 받아요.

<DataTable :value="products" tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity"></Column>
</DataTable>

컬럼 그룹 (Column Group)

컬럼은 Row 컴포넌트 안에서 그룹으로 묶을 수 있고, 이 그룹들은 ColumnGroup 컴포넌트로 표시해요. 그룹은 header 또는 footer 값을 가질 수 있는 type 프로퍼티로 표현해요. 셀이나 행이 차지할 칸 수는 Column의 colspan과 rowspan 프로퍼티로 정의해요.

<DataTable :value="sales" tableStyle="min-width: 50rem">
    <ColumnGroup type="header">
        <Row>
            <Column header="Product" :rowspan="3" />
            <Column header="Sale Rate" :colspan="4" />
        </Row>
        <Row>
            <Column header="Sales" :colspan="2" />
            <Column header="Profits" :colspan="2" />
        </Row>
        <Row>
            <Column header="Last Year" sortable field="lastYearSale" />
            <Column header="This Year" sortable field="thisYearSale" />
            <Column header="Last Year" sortable field="lastYearProfit" />
            <Column header="This Year" sortable field="thisYearProfit" />
        </Row>
    </ColumnGroup>
    <Column field="product" />
    <Column field="lastYearSale">
        <template #body="slotProps"> {{ slotProps.data.lastYearSale }}% </template>
    </Column>
    <Column field="thisYearSale">
        <template #body="slotProps"> {{ slotProps.data.thisYearSale }}% </template>
    </Column>
    <Column field="lastYearProfit">
        <template #body="slotProps">
            {{ formatCurrency(slotProps.data.lastYearProfit) }}
        </template>
    </Column>
    <Column field="thisYearProfit">
        <template #body="slotProps">
            {{ formatCurrency(slotProps.data.thisYearProfit) }}
        </template>
    </Column>
    <ColumnGroup type="footer">
        <Row>
            <Column footer="Totals:" :colspan="3" footerStyle="text-align:right" />
            <Column :footer="lastYearTotal" />
            <Column :footer="thisYearTotal" />
        </Row>
    </ColumnGroup>
</DataTable>
Composition API Example
<template>
    <DataTable :value="sales" tableStyle="min-width: 50rem">
        <ColumnGroup type="header">
            <Row>
                <Column header="Product" :rowspan="3" />
                <Column header="Sale Rate" :colspan="4" />
            </Row>
            <Row>
                <Column header="Sales" :colspan="2" />
                <Column header="Profits" :colspan="2" />
            </Row>
            <Row>
                <Column header="Last Year" sortable field="lastYearSale"/>
                <Column header="This Year" sortable field="thisYearSale"/>
                <Column header="Last Year" sortable field="lastYearProfit"/>
                <Column header="This Year" sortable field="thisYearProfit"/>
            </Row>
        </ColumnGroup>
        <Column field="product" />
        <Column field="lastYearSale">
            <template #body="slotProps">
                {{slotProps.data.lastYearSale}}%
            </template>
        </Column>
        <Column field="thisYearSale">
            <template #body="slotProps">
                {{slotProps.data.thisYearSale}}%
            </template>
        </Column>
        <Column field="lastYearProfit">
            <template #body="slotProps">
                {{formatCurrency(slotProps.data.lastYearProfit)}}
            </template>
        </Column>
        <Column field="thisYearProfit">
            <template #body="slotProps">
                {{formatCurrency(slotProps.data.thisYearProfit)}}
            </template>
        </Column>
        <ColumnGroup type="footer">
            <Row>
                <Column footer="Totals:" :colspan="3" footerStyle="text-align:right"/>
                <Column :footer="lastYearTotal" />
                <Column :footer="thisYearTotal" />
            </Row>
        </ColumnGroup>
    </DataTable>
</template>

<script setup>
import { ref, computed } from 'vue';

const sales = ref([
    {product: 'Bamboo Watch', lastYearSale: 51, thisYearSale: 40, lastYearProfit: 54406, thisYearProfit: 43342},
    {product: 'Black Watch', lastYearSale: 83, thisYearSale: 9, lastYearProfit: 423132, thisYearProfit: 312122},
    {product: 'Blue Band', lastYearSale: 38, thisYearSale: 5, lastYearProfit: 12321, thisYearProfit: 8500},
    {product: 'Blue T-Shirt', lastYearSale: 49, thisYearSale: 22, lastYearProfit: 745232, thisYearProfit: 65323},
    {product: 'Brown Purse', lastYearSale: 17, thisYearSale: 79, lastYearProfit: 643242, thisYearProfit: 500332},
    {product: 'Chakra Bracelet', lastYearSale: 52, thisYearSale:  65, lastYearProfit: 421132, thisYearProfit: 150005},
    {product: 'Galaxy Earrings', lastYearSale: 82, thisYearSale: 12, lastYearProfit: 131211, thisYearProfit: 100214},
    {product: 'Game Controller', lastYearSale: 44, thisYearSale: 45, lastYearProfit: 66442, thisYearProfit: 53322},
    {product: 'Gaming Set', lastYearSale: 90, thisYearSale: 56, lastYearProfit: 765442, thisYearProfit: 296232},
    {product: 'Gold Phone Case', lastYearSale: 75, thisYearSale: 54, lastYearProfit: 21212, thisYearProfit: 12533}
]);

const formatCurrency = (value) => {
    return value.toLocaleString('en-US', {style: 'currency', currency: 'USD'});
};

const lastYearTotal = computed(() => {
    let total = 0;
    for(let sale of sales.value) {
        total += sale.lastYearProfit;
    }

    return formatCurrency(total);
});

const thisYearTotal = computed(() => {
    let total = 0;
    for(let sale of sales.value) {
        total += sale.thisYearProfit;
    }

    return formatCurrency(total);
});

<\/script>

컬럼 토글 (Column Toggle)

조건에 따라 컬럼 표시 여부를 바꿔야 한다면 동적 컬럼으로 구현해요. 이 예제에서는 MultiSelect로 보이는 컬럼을 관리해요.

<DataTable :value="products" tableStyle="min-width: 50rem">
    <template #header>
        <div style="text-align:left">
            <MultiSelect :modelValue="selectedColumns" :options="columns" optionLabel="header" @update:modelValue="onToggle"
                display="chip" placeholder="Select Columns" />
        </div>
    </template>
    <Column field="code" header="Code" />
    <Column v-for="(col, index) of selectedColumns" :field="col.field" :header="col.header" :key="col.field + '_' + index"></Column>
</DataTable>
Composition API Example
<template>
    <div>
        <DataTable :value="products" tableStyle="min-width: 50rem">
            <template #header>
                <div style="text-align:left">
                    <MultiSelect :modelValue="selectedColumns" :options="columns" optionLabel="header" @update:modelValue="onToggle"
                        display="chip" placeholder="Select Columns" />
                </div>
            </template>
            <Column field="code" header="Code" />
            <Column v-for="(col, index) of selectedColumns" :field="col.field" :header="col.header" :key="col.field + '_' + index"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const columns = ref([
    {field: 'name', header: 'Name'},
    {field: 'category', header: 'Category'},
    {field: 'quantity', header: 'Quantity'}
]);
const selectedColumns = ref(columns.value);
const products = ref();
const onToggle = (val) => {
    selectedColumns.value = columns.value.filter(col => val.includes(col));
};

<\/script>

조건부 스타일 (Conditional Style)

특정 행이나 셀을 조건에 따라 스타일링할 수 있어요. rowClass는 행 데이터를 파라미터로 받아 그 행에 적용할 스타일 클래스를 돌려주고, 셀은 body 템플릿으로 커스터마이즈해요.

<DataTable :value="products" :rowClass="rowClass" :rowStyle="rowStyle" tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity">
        <template #body="slotProps">
            <Badge :value="slotProps.data.quantity" :severity="stockSeverity(slotProps.data)" />
        </template>
    </Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable :value="products" :rowClass="rowClass" :rowStyle="rowStyle" tableStyle="min-width: 50rem">
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity">
                <template #body="slotProps">
                    <Badge :value="slotProps.data.quantity" :severity="stockSeverity(slotProps.data)" />
                </template>
            </Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsSmall().then((data) => (this.products = data));
});

const products = ref();

const rowClass = (data) => {
    return [{ '!bg-primary !text-primary-contrast': data.category === 'Fitness' }];
};
const rowStyle = (data) => {
    if (data.quantity === 0) {
        return { fontWeight: 'bold', fontStyle: 'italic' };
    }
};
const stockSeverity = (data) => {
    if (data.quantity === 0) return 'danger';
    else if (data.quantity > 0 && data.quantity < 10) return 'warn';
    else return 'success';
}

<\/script>

컨텍스트 메뉴 (Context Menu)

DataTable은 ContextMenu와 전용 통합을 제공해요. contextMenu 이벤트로 오른쪽 클릭 시 메뉴를 열고, contextMenuSelection 프로퍼티와 row-contextmenu 이벤트로 메뉴를 통한 선택을 제어해요.

<ContextMenu ref="cm" :model="menuModel" @hide="selectedProduct = null" />
<DataTable v-model:contextMenuSelection="selectedProduct" :value="products" contextMenu @row-contextmenu="onRowContextMenu" tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="price" header="Price">
        <template #body="slotProps">
            {{ formatCurrency(slotProps.data.price) }}
        </template>
    </Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <ContextMenu ref="cm" :model="menuModel" @hide="selectedProduct = null" />
        <DataTable :value="products" contextMenu v-model:contextMenuSelection="selectedProduct"
                @rowContextmenu="onRowContextMenu" tableStyle="min-width: 50rem">
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="price" header="Price">
                <template #body="slotProps">
                    {{formatCurrency(slotProps.data.price)}}
                </template>
                </Column>
        </DataTable>
        <Toast />
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { useToast } from 'primevue/usetoast';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const cm = ref();
const toast = useToast();
const products = ref();
const selectedProduct = ref();
const menuModel = ref([
    {label: 'View', icon: 'pi pi-fw pi-search', command: () => viewProduct(selectedProduct)},
    {label: 'Delete', icon: 'pi pi-fw pi-times', command: () => deleteProduct(selectedProduct)}
]);
const onRowContextMenu = (event) => {
    cm.value.show(event.originalEvent);
};
const viewProduct = (product) => {
    toast.add({severity: 'info', summary: 'Product Selected', detail: product.value.name, life: 3000});
};
const deleteProduct = (product) => {
    products.value = products.value.filter((p) => p.id !== product.value.id);
    toast.add({severity: 'error', summary: 'Product Deleted', detail: product.value.name, life: 3000});
    selectedProduct.value = null;
};
const formatCurrency = (value) => {
    return value.toLocaleString('en-US', {style: 'currency', currency: 'USD'});
};

<\/script>

동적 컬럼 (Dynamic Columns)

컬럼은 프로그래밍 방식으로 만들 수도 있어요.

<DataTable :value="products" tableStyle="min-width: 50rem">
    <Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header"></Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable :value="products" tableStyle="min-width: 50rem">
            <Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const products = ref();
const columns = [
    { field: 'code', header: 'Code' },
    { field: 'name', header: 'Name' },
    { field: 'category', header: 'Category' },
    { field: 'quantity', header: 'Quantity' }
];

<\/script>

내보내기 (Export)

DataTable은 데이터를 CSV 형식으로 내보낼 수 있어요.

<DataTable :value="products" ref="dt" tableStyle="min-width: 50rem">
    <template #header>
        <div class="text-end pb-4">
            <Button icon="pi pi-external-link" label="Export" @click="exportCSV($event)" />
        </div>
    </template>
    <Column field="code" header="Code" exportHeader="Product Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity"></Column>
</DataTable>
Composition API Example
<template>
    <div>
        <DataTable :value="products" ref="dt" tableStyle="min-width: 50rem">
            <template #header>
                <div class="text-end pb-4">
                    <Button icon="pi pi-external-link" label="Export" @click="exportCSV($event)" />
                </div>
            </template>
            <Column field="code" header="Code" exportHeader="Product Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const dt = ref();
const products = ref();
const exportCSV = () => {
    dt.value.exportCSV();
};
<\/script>

그리드 선 (Grid Lines)

showGridlines를 켜면 셀 사이에 테두리가 표시돼요.

<DataTable :value="products" showGridlines tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity"></Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable :value="products" showGridlines tableStyle="min-width: 50rem">
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const products = ref();

<\/script>

지연 로딩 (Lazy Load)

큰 데이터셋을 다룰 때는 lazy 모드가 편해요. 전체 데이터를 한 번에 로드하지 않고, paging, sorting, filtering이 일어날 때마다 대응하는 콜백을 호출해 작은 단위의 데이터를 불러와요. 아래 예제는 메모리 리스트와 타임아웃으로 네트워크 연결을 흉내 내며, 원격 데이터소스에서의 지연 로딩을 재현해요. 구현의 핵심은 lazy 프로퍼티를 켜고, 프로젝션 쿼리로 totalRecords에 논리적인 행 수를 할당하는 거예요. 그러면 실제로는 현재 페이지에 표시되는 레코드만 존재하지만, 페이지네이터는 totalRecords 크기의 데이터가 있는 것처럼 UI를 표시해요. lazy 모드에서의 체크박스 선택은 DataTable이 전체 데이터셋을 알 수 없기 때문에 이 예제처럼 직접 구현해야 한다는 점도 기억하세요.

<DataTable
    :value="customers"
    lazy
    paginator
    :first="first"
    :rows="10"
    v-model:filters="filters"
    ref="dt"
    dataKey="id"
    :totalRecords="totalRecords"
    :loading="loading"
    @page="onPage($event)"
    @sort="onSort($event)"
    @filter="onFilter($event)"
    filterDisplay="row"
    :globalFilterFields="['name', 'country.name', 'company', 'representative.name']"
    v-model:selection="selectedCustomers"
    :selectAll="selectAll"
    @select-all-change="onSelectAllChange"
    @row-select="onRowSelect"
    @row-unselect="onRowUnselect"
    tableStyle="min-width: 75rem"
>
    <Column selectionMode="multiple" headerStyle="width: 3rem"></Column>
    <Column field="name" header="Name" filterMatchMode="startsWith" sortable>
        <template #filter="{filterModel,filterCallback}">
            <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
        </template>
    </Column>
    <Column field="country.name" header="Country" filterField="country.name" filterMatchMode="contains" sortable>
        <template #body="{ data }">
            <div class="flex items-center gap-2">
                <img alt="flag" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${data.country.code}\`" style="width: 24px" />
                <span>{{ data.country.name }}</span>
            </div>
        </template>
        <template #filter="{filterModel,filterCallback}">
            <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
        </template>
    </Column>
    <Column field="company" header="Company" filterMatchMode="contains" sortable>
        <template #filter="{filterModel,filterCallback}">
            <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
        </template>
    </Column>
    <Column field="representative.name" header="Representative" filterField="representative.name" sortable>
        <template #body="{ data }">
            <div class="flex items-center gap-2">
                <img :alt="data.representative.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${data.representative.image}\`" style="width: 32px" />
                <span>{{ data.representative.name }}</span>
            </div>
        </template>
        <template #filter="{filterModel,filterCallback}">
            <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
        </template>
    </Column>
</DataTable>
Composition API Example
<template>
	<div class="card">
        <DataTable :value="customers" lazy paginator :first="first" :rows="10" v-model:filters="filters" ref="dt" dataKey="id"
            :totalRecords="totalRecords" :loading="loading" @page="onPage($event)" @sort="onSort($event)" @filter="onFilter($event)" filterDisplay="row"
            :globalFilterFields="['name','country.name', 'company', 'representative.name']"
            v-model:selection="selectedCustomers" :selectAll="selectAll" @select-all-change="onSelectAllChange" @row-select="onRowSelect" @row-unselect="onRowUnselect" tableStyle="min-width: 75rem">
            <Column selectionMode="multiple" headerStyle="width: 3rem"></Column>
            <Column field="name" header="Name" filterMatchMode="startsWith" sortable>
                <template #filter="{filterModel,filterCallback}">
                    <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
                </template>
            </Column>
            <Column field="country.name" header="Country" filterField="country.name" filterMatchMode="contains" sortable>
                <template #body="{ data }">
                    <div class="flex items-center gap-2">
                        <img alt="flag" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${data.country.code}\`" style="width: 24px" />
                        <span>{{ data.country.name }}</span>
                    </div>
                </template>
                <template #filter="{filterModel,filterCallback}">
                    <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
                </template>
            </Column>
            <Column field="company" header="Company" filterMatchMode="contains" sortable>
                <template #filter="{filterModel,filterCallback}">
                    <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
                </template>
            </Column>
            <Column field="representative.name" header="Representative" filterField="representative.name" sortable>
                <template #body="{ data }">
                    <div class="flex items-center gap-2">
                        <img :alt="data.representative.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${data.representative.image}\`" style="width: 32px" />
                        <span>{{ data.representative.name }}</span>
                    </div>
                </template>
                <template #filter="{filterModel,filterCallback}">
                    <InputText type="text" v-model="filterModel.value" @keydown.enter="filterCallback()" placeholder="Search" fluid/>
                </template>
            </Column>
        </DataTable>
	</div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { CustomerService } from '@/service/CustomerService';

onMounted(() => {
    loading.value = true;

    lazyParams.value = {
        first: 0,
        rows: 10,
        sortField: null,
        sortOrder: null,
        filters: filters.value
    };

    loadLazyData();
});

const dt = ref();
const loading = ref(false);
const totalRecords = ref(0);
const customers = ref();
const selectedCustomers = ref();
const selectAll = ref(false);
const first = ref(0);
const filters = ref({
    'name': {value: '', matchMode: 'contains'},
    'country.name': {value: '', matchMode: 'contains'},
    'company': {value: '', matchMode: 'contains'},
    'representative.name': {value: '', matchMode: 'contains'},
});
const lazyParams = ref({});
const columns = ref([
    {field: 'name', header: 'Name'},
    {field: 'country.name', header: 'Country'},
    {field: 'company', header: 'Company'},
    {field: 'representative.name', header: 'Representative'}
]);

const loadLazyData = (event) => {
    loading.value = true;
    lazyParams.value = { ...lazyParams.value, first: event?.first || first.value };

    setTimeout(() => {
        CustomerService.getCustomers({ lazyEvent: JSON.stringify(lazyParams.value) }).then((data) => {
            customers.value = data.customers;
            totalRecords.value = data.totalRecords;
            loading.value = false;
        });
    }, Math.random() * 1000 + 250);
};
const onPage = (event) => {
    lazyParams.value = event;
    loadLazyData(event);
};
const onSort = (event) => {
    lazyParams.value = event;
    loadLazyData(event);
};
const onFilter = (event) => {
    lazyParams.value.filters = filters.value ;
    loadLazyData(event);
};
const onSelectAllChange = (event) => {
    selectAll.value = event.checked;

    if (selectAll) {
        CustomerService.getCustomers().then(data => {
            selectAll.value = true;
            selectedCustomers.value = data.customers;
        });
    }
    else {
        selectAll.value = false;
        selectedCustomers.value = [];
    }
};
const onRowSelect = () => {
    selectAll.value = selectedCustomers.value.length === totalRecords.value;
};
const onRowUnselect = () => {
    selectAll.value = false;
};

<\/script>

재정렬 (Reorder)

컬럼과 행의 순서는 드래그 앤 드롭으로 바꿀 수 있어요. 컬럼 재정렬은 reorderableColumns 프로퍼티로 켜요. 마찬가지로 컬럼에 rowReorder 프로퍼티를 추가하면 행을 드래그할 수 있어요. 드래그 핸들을 쓰려면 해당 컬럼에 rowReorder 프로퍼티가 필요하고, 재정렬이 끝난 뒤 행 상태를 제어하려면 테이블의 row-reorder 이벤트를 연결해야 해요.

<DataTable :value="products" :reorderableColumns="true" @columnReorder="onColReorder" @rowReorder="onRowReorder" tableStyle="min-width: 50rem">
    <Column rowReorder headerStyle="width: 3rem" :reorderableColumn="false" />
    <Column v-for="col of columns" :field="col.field" :header="col.header" :key="col.field"></Column>
</DataTable>
Composition API Example
<template>
	<div>
        <DataTable :value="products" :reorderableColumns="true" @columnReorder="onColReorder" @rowReorder="onRowReorder" tableStyle="min-width: 50rem">
            <Column rowReorder headerStyle="width: 3rem" :reorderableColumn="false" />
            <Column v-for="col of columns" :field="col.field" :header="col.header" :key="col.field"></Column>
        </DataTable>
        <Toast />
	</div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { useToast } from 'primevue/usetoast';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then(data => products.value = data);
});

const toast = useToast();
const columns = ref([
    {field: 'code', header: 'Code'},
    {field: 'name', header: 'Name'},
    {field: 'category', header: 'Category'},
    {field: 'quantity', header: 'Quantity'}
]);
const products = ref();

const onColReorder = () => {
    toast.add({severity:'success', summary: 'Column Reordered', life: 3000});
};
const onRowReorder = (event) => {
    products.value = event.value;
    toast.add({severity:'success', summary: 'Rows Reordered', life: 3000});
};

<\/script>

행 확장 (Row Expansion)

행 확장은 expandedRows 프로퍼티로 제어해요. expander 엘리먼트를 둔 컬럼에는 expander 프로퍼티를 켜야 해요. rowExpand와 rowCollapse 이벤트를 콜백으로 쓸 수도 있어요. 펼쳐진 행은 행 데이터의 배열이거나, dataKey가 있으면 행 데이터 식별자를 문자열 키로, 확장 여부를 불리언 값으로 갖는 객체일 수도 있어요. 예컨대 {'1004': true} 같은 형태예요. 대량의 데이터에서는 dataKey 방식이 더 성능이 좋아요.

<DataTable v-model:expandedRows="expandedRows" :value="products" dataKey="id"
        @rowExpand="onRowExpand" @rowCollapse="onRowCollapse" tableStyle="min-width: 60rem">
    <template #header>
        <div class="flex flex-wrap justify-end gap-2">
            <Button variant="text" icon="pi pi-plus" label="Expand All" @click="expandAll" />
            <Button variant="text" icon="pi pi-minus" label="Collapse All" @click="collapseAll" />
        </div>
    </template>
    <Column expander style="width: 5rem" />
    <Column field="name" header="Name"></Column>
    <Column header="Image">
        <template #body="slotProps">
            <img :src="\`https://primefaces.org/cdn/primevue/images/product/\${slotProps.data.image}\`" :alt="slotProps.data.image" class="shadow-lg" width="64" />
        </template>
    </Column>
    <Column field="price" header="Price">
        <template #body="slotProps">
            {{ formatCurrency(slotProps.data.price) }}
        </template>
    </Column>
    <Column field="category" header="Category"></Column>
    <Column field="rating" header="Reviews">
        <template #body="slotProps">
            <Rating :modelValue="slotProps.data.rating" readonly />
        </template>
    </Column>
    <Column header="Status">
        <template #body="slotProps">
            <Tag :value="slotProps.data.inventoryStatus" :severity="getSeverity(slotProps.data)" />
        </template>
    </Column>
    <template #expansion="slotProps">
        <div class="p-4">
            <h5>Orders for {{ slotProps.data.name }}</h5>
            <DataTable :value="slotProps.data.orders">
                <Column field="id" header="Id" sortable></Column>
                <Column field="customer" header="Customer" sortable></Column>
                <Column field="date" header="Date" sortable></Column>
                <Column field="amount" header="Amount" sortable>
                    <template #body="slotProps">
                        {{ formatCurrency(slotProps.data.amount) }}
                    </template>
                </Column>
                <Column field="status" header="Status" sortable>
                    <template #body="slotProps">
                        <Tag :value="slotProps.data.status.toLowerCase()" :severity="getOrderSeverity(slotProps.data)" />
                    </template>
                </Column>
                <Column headerStyle="width:4rem">
                    <template #body>
                        <Button icon="pi pi-search" />
                    </template>
                </Column>
            </DataTable>
        </div>
    </template>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable v-model:expandedRows="expandedRows" :value="products" dataKey="id"
                @rowExpand="onRowExpand" @rowCollapse="onRowCollapse" tableStyle="min-width: 60rem">
            <template #header>
                <div class="flex flex-wrap justify-end gap-2">
                    <Button variant="text" icon="pi pi-plus" label="Expand All" @click="expandAll" />
                    <Button variant="text" icon="pi pi-minus" label="Collapse All" @click="collapseAll" />
                </div>
            </template>
            <Column expander style="width: 5rem" />
            <Column field="name" header="Name"></Column>
            <Column header="Image">
                <template #body="slotProps">
                    <img :src="\`https://primefaces.org/cdn/primevue/images/product/\${slotProps.data.image}\`" :alt="slotProps.data.image" class="shadow-lg" width="64" />
                </template>
            </Column>
            <Column field="price" header="Price">
                <template #body="slotProps">
                    {{ formatCurrency(slotProps.data.price) }}
                </template>
            </Column>
            <Column field="category" header="Category"></Column>
            <Column field="rating" header="Reviews">
                <template #body="slotProps">
                    <Rating :modelValue="slotProps.data.rating" readonly />
                </template>
            </Column>
            <Column header="Status">
                <template #body="slotProps">
                    <Tag :value="slotProps.data.inventoryStatus" :severity="getSeverity(slotProps.data)" />
                </template>
            </Column>
            <template #expansion="slotProps">
                <div class="p-4">
                    <h5>Orders for {{ slotProps.data.name }}</h5>
                    <DataTable :value="slotProps.data.orders">
                        <Column field="id" header="Id" sortable></Column>
                        <Column field="customer" header="Customer" sortable></Column>
                        <Column field="date" header="Date" sortable></Column>
                        <Column field="amount" header="Amount" sortable>
                            <template #body="slotProps">
                                {{ formatCurrency(slotProps.data.amount) }}
                            </template>
                        </Column>
                        <Column field="status" header="Status" sortable>
                            <template #body="slotProps">
                                <Tag :value="slotProps.data.status.toLowerCase()" :severity="getOrderSeverity(slotProps.data)" />
                            </template>
                        </Column>
                        <Column headerStyle="width:4rem">
                            <template #body>
                                <Button icon="pi pi-search" />
                            </template>
                        </Column>
                    </DataTable>
                </div>
            </template>
        </DataTable>
        <Toast />
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { useToast } from 'primevue/usetoast';
import { ProductService } from '@/service/ProductService';

const products = ref();
const expandedRows = ref({});
const toast = useToast();

onMounted(() => {
    ProductService.getProductsWithOrdersSmall().then((data) => (products.value = data));
});

const onRowExpand = (event) => {
    toast.add({ severity: 'info', summary: 'Product Expanded', detail: event.data.name, life: 3000 });
};
const onRowCollapse = (event) => {
    toast.add({ severity: 'success', summary: 'Product Collapsed', detail: event.data.name, life: 3000 });
};
const expandAll = () => {
    expandedRows.value = products.value.reduce((acc, p) => (acc[p.id] = true) && acc, {});
};
const collapseAll = () => {
    expandedRows.value = null;
};
const formatCurrency = (value) => {
    return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
};
const getSeverity = (product) => {
    switch (product.inventoryStatus) {
        case 'INSTOCK':
            return 'success';

        case 'LOWSTOCK':
            return 'warn';

        case 'OUTOFSTOCK':
            return 'danger';

        default:
            return null;
    }
};
const getOrderSeverity = (order) => {
    switch (order.status) {
        case 'DELIVERED':
            return 'success';

        case 'CANCELLED':
            return 'danger';

        case 'PENDING':
            return 'warn';

        case 'RETURNED':
            return 'info';

        default:
            return null;
    }
};

<\/script>

크기 (Size)

기본 테이블 외에 크기별 대안들도 준비되어 있어요.

<SelectButton v-model="size" :options="sizeOptions" optionLabel="label" dataKey="label" />
<DataTable :value="products" :size="size.value" tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity"></Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <div class="flex justify-center mb-6">
            <SelectButton v-model="size" :options="sizeOptions" optionLabel="label" dataKey="label" />
        </div>
        <DataTable :value="products" :size="size.value" tableStyle="min-width: 50rem">
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const products = ref();
const size = ref({ label: 'Normal', value: 'null' });
const sizeOptions = ref([
    { label: 'Small', value: 'small' },
    { label: 'Normal', value: 'null' },
    { label: 'Large', value: 'large' }
]);

<\/script>

상태 저장 (Stateful)

상태 저장(stateful) 테이블은 페이지, 정렬, 필터링 같은 상태를 로컬 스토리지나 세션 스토리지에 담아 둘 수 있어요. 그래서 페이지를 다시 방문하면 마지막 설정으로 테이블을 렌더링해요. 이 기능을 체험하려면 테이블 상태를 바꾸고(예: 페이지 이동) 다른 곳으로 나갔다가 다시 돌아와 보세요. 이 예제는 stateStorage 프로퍼티를 session으로 설정해서 브라우저를 닫을 때까지 Table이 상태를 유지해요. 상태 수명을 더 늘리려면 localStorage를 가리키는 local을 고르면 돼요.

<DataTable
    v-model:filters="filters"
    v-model:selection="selectedCustomer"
    :value="customers"
    stateStorage="session"
    stateKey="dt-state-demo-session"
    paginator
    :rows="5"
    filterDisplay="menu"
    selectionMode="single"
    dataKey="id"
    :globalFilterFields="['name', 'country.name', 'representative.name', 'status']"
    tableStyle="min-width: 50rem"
>
    <template #header>
        <IconField>
            <InputIcon>
                <i class="pi pi-search" />
            </InputIcon>
            <InputText v-model="filters['global'].value" placeholder="Global Search" />
        </IconField>
    </template>
    <Column field="name" header="Name" sortable style="width: 25%">
        <template #filter="{ filterModel }">
            <InputText v-model="filterModel.value" type="text" placeholder="Search by name" />
        </template>
    </Column>
    <Column header="Country" sortable sortField="country.name" filterField="country.name" filterMatchMode="contains" style="width: 25%">
        <template #body="{ data }">
            <div class="flex items-center gap-2">
                <img alt="flag" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${data.country.code}\`" style="width: 24px" />
                <span>{{ data.country.name }}</span>
            </div>
        </template>
        <template #filter="{ filterModel }">
            <InputText v-model="filterModel.value" type="text" placeholder="Search by country" />
        </template>
    </Column>
    <Column header="Representative" sortable sortField="representative.name" filterField="representative" :showFilterMatchModes="false" :filterMenuStyle="{ width: '14rem' }" style="width: 25%">
        <template #body="{ data }">
            <div class="flex items-center gap-2">
                <img :alt="data.representative.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${data.representative.image}\`" style="width: 32px" />
                <span>{{ data.representative.name }}</span>
            </div>
        </template>
        <template #filter="{ filterModel }">
            <MultiSelect v-model="filterModel.value" :options="representatives" optionLabel="name" placeholder="Any">
                <template #option="slotProps">
                    <div class="flex items-center gap-2">
                        <img :alt="slotProps.option.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${slotProps.option.image}\`" style="width: 32px" />
                        <span>{{ slotProps.option.name }}</span>
                    </div>
                </template>
            </MultiSelect>
        </template>
    </Column>
    <Column field="status" header="Status" sortable filterMatchMode="equals" style="width: 25%">
        <template #body="{ data }">
            <Tag :value="data.status" :severity="getSeverity(data.status)" />
        </template>
        <template #filter="{ filterModel }">
            <Select v-model="filterModel.value" :options="statuses" placeholder="Select One" showClear>
                <template #option="slotProps">
                    <Tag :value="slotProps.option" :severity="getSeverity(slotProps.option)" />
                </template>
            </Select>
        </template>
    </Column>
    <template #empty> No customers found. </template>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable v-model:filters="filters" v-model:selection="selectedCustomer" :value="customers"
                stateStorage="session" stateKey="dt-state-demo-session" paginator :rows="5" filterDisplay="menu"
                selectionMode="single" dataKey="id" :globalFilterFields="['name', 'country.name', 'representative.name', 'status']" tableStyle="min-width: 50rem">
            <template #header>
                <IconField>
                <InputIcon>
                    <i class="pi pi-search" />
                </InputIcon>
                <InputText v-model="filters['global'].value" placeholder="Global Search" />
            </IconField>
            </template>
            <Column field="name" header="Name" sortable style="width: 25%">
                <template #filter="{ filterModel }">
                    <InputText v-model="filterModel.value" type="text" placeholder="Search by name" />
                </template>
            </Column>
            <Column header="Country" sortable sortField="country.name" filterField="country.name" filterMatchMode="contains" style="width: 25%">
                <template #body="{ data }">
                    <div class="flex items-center gap-2">
                        <img alt="flag" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${data.country.code}\`" style="width: 24px" />
                        <span>{{ data.country.name }}</span>
                    </div>
                </template>
                <template #filter="{ filterModel }">
                    <InputText v-model="filterModel.value" type="text" placeholder="Search by country" />
                </template>
            </Column>
            <Column header="Representative" sortable sortField="representative.name" filterField="representative" :showFilterMatchModes="false" :filterMenuStyle="{ width: '14rem' }" style="width: 25%">
                <template #body="{ data }">
                    <div class="flex items-center gap-2">
                        <img :alt="data.representative.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${data.representative.image}\`" style="width: 32px" />
                        <span>{{ data.representative.name }}</span>
                    </div>
                </template>
                <template #filter="{ filterModel }">
                    <MultiSelect v-model="filterModel.value" :options="representatives" optionLabel="name" placeholder="Any">
                        <template #option="slotProps">
                            <div class="flex items-center gap-2">
                                <img :alt="slotProps.option.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${slotProps.option.image}\`" style="width: 32px" />
                                <span>{{ slotProps.option.name }}</span>
                            </div>
                        </template>
                    </MultiSelect>
                </template>
            </Column>
            <Column field="status" header="Status" sortable filterMatchMode="equals" style="width: 25%">
                <template #body="{ data }">
                    <Tag :value="data.status" :severity="getSeverity(data.status)" />
                </template>
                <template #filter="{ filterModel }">
                    <Select v-model="filterModel.value" :options="statuses" placeholder="Select One" showClear>
                        <template #option="slotProps">
                            <Tag :value="slotProps.option" :severity="getSeverity(slotProps.option)" />
                        </template>
                    </Select>
                </template>
            </Column>
            <template #empty> No customers found. </template>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { CustomerService } from '@/service/CustomerService';
import { FilterMatchMode, FilterOperator } from '@primevue/core/api';

const customers = ref();
const selectedCustomer = ref();
const filters = ref(
    {
        global: { value: null, matchMode: FilterMatchMode.CONTAINS },
        name: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
        'country.name': { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
        representative: { value: null, matchMode: FilterMatchMode.IN },
        status: { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] }
    }
);
const representatives = ref([
    { name: 'Amy Elsner', image: 'amyelsner.png' },
    { name: 'Anna Fali', image: 'annafali.png' },
    { name: 'Asiya Javayant', image: 'asiyajavayant.png' },
    { name: 'Bernardo Dominic', image: 'bernardodominic.png' },
    { name: 'Elwin Sharvill', image: 'elwinsharvill.png' },
    { name: 'Ioni Bowcher', image: 'ionibowcher.png' },
    { name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' },
    { name: 'Onyama Limba', image: 'onyamalimba.png' },
    { name: 'Stephen Shaw', image: 'stephenshaw.png' },
    { name: 'XuXue Feng', image: 'xuxuefeng.png' }
]);
const statuses = ref(['unqualified', 'qualified', 'new', 'negotiation', 'renewal', 'proposal']);

onMounted(() => {
    CustomerService.getCustomersSmall().then((data) => (customers.value = data));
});

const getSeverity = (status) => {
    switch (status) {
        case 'unqualified':
            return 'danger';

        case 'qualified':
            return 'success';

        case 'new':
            return 'info';

        case 'negotiation':
            return 'warn';

        case 'renewal':
            return null;
    }
};

<\/script>

줄무늬 행 (Striped Rows)

stripedRows 프로퍼티가 있으면 행이 교대로 다른 색으로 표시돼요.

<DataTable :value="products" stripedRows tableStyle="min-width: 50rem">
    <Column field="code" header="Code"></Column>
    <Column field="name" header="Name"></Column>
    <Column field="category" header="Category"></Column>
    <Column field="quantity" header="Quantity"></Column>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable :value="products" stripedRows tableStyle="min-width: 50rem">
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity"></Column>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const products = ref();

<\/script>

템플릿 (Template)

헤더와 푸터 섹션에는 템플릿으로 커스텀 콘텐츠를 넣을 수 있어요.

<DataTable :value="products" tableStyle="min-width: 50rem">
    <template #header>
        <div class="flex flex-wrap items-center justify-between gap-2">
            <span class="text-xl font-bold">Products</span>
            <Button icon="pi pi-refresh" rounded raised />
        </div>
    </template>
    <Column field="name" header="Name"></Column>
    <Column header="Image">
        <template #body="slotProps">
            <img :src="\`https://primefaces.org/cdn/primevue/images/product/\${slotProps.data.image}\`" :alt="slotProps.data.image" class="w-24 rounded" />
        </template>
    </Column>
    <Column field="price" header="Price">
        <template #body="slotProps">
            {{ formatCurrency(slotProps.data.price) }}
        </template>
    </Column>
    <Column field="category" header="Category"></Column>
    <Column field="rating" header="Reviews">
        <template #body="slotProps">
            <Rating :modelValue="slotProps.data.rating" readonly />
        </template>
    </Column>
    <Column header="Status">
        <template #body="slotProps">
            <Tag :value="slotProps.data.inventoryStatus" :severity="getSeverity(slotProps.data)" />
        </template>
    </Column>
    <template #footer> In total there are {{ products ? products.length : 0 }} products. </template>
</DataTable>
Composition API Example
<template>
    <div class="card">
        <DataTable :value="products" tableStyle="min-width: 50rem">
            <template #header>
                <div class="flex flex-wrap items-center justify-between gap-2">
                    <span class="text-xl font-bold">Products</span>
                    <Button icon="pi pi-refresh" rounded raised />
                </div>
            </template>
            <Column field="name" header="Name"></Column>
            <Column header="Image">
                <template #body="slotProps">
                    <img :src="\`https://primefaces.org/cdn/primevue/images/product/\${slotProps.data.image}\`" :alt="slotProps.data.image" class="w-24 rounded" />
                </template>
            </Column>
            <Column field="price" header="Price">
                <template #body="slotProps">
                    {{ formatCurrency(slotProps.data.price) }}
                </template>
            </Column>
            <Column field="category" header="Category"></Column>
            <Column field="rating" header="Reviews">
                <template #body="slotProps">
                    <Rating :modelValue="slotProps.data.rating" readonly />
                </template>
            </Column>
            <Column header="Status">
                <template #body="slotProps">
                    <Tag :value="slotProps.data.inventoryStatus" :severity="getSeverity(slotProps.data)" />
                </template>
            </Column>
            <template #footer> In total there are {{ products ? products.length : 0 }} products. </template>
        </DataTable>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService';

onMounted(() => {
    ProductService.getProductsMini().then((data) => (products.value = data));
});

const products = ref();
const formatCurrency = (value) => {
    return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
};
const getSeverity = (product) => {
    switch (product.inventoryStatus) {
        case 'INSTOCK':
            return 'success';

        case 'LOWSTOCK':
            return 'warn';

        case 'OUTOFSTOCK':
            return 'danger';

        default:
            return null;
    }
};

<\/script>

Data Table

Props

이름 타입 기본값 설명
value null | readonly T[] - 표시할 객체 배열이에요.
dataKey keyof T | Function - 데이터에서 레코드를 고유하게 식별하는 필드 이름이에요.
rows number 0 한 페이지에 표시할 행 수예요.
first number 0 표시할 첫 번째 행의 인덱스예요.
totalRecords number 0 전체 레코드 수예요. 정의하지 않으면 value 길이를 기본값으로 사용해요.
paginator boolean false true로 지정하면 페이지네이션이 켜져요.
paginatorPosition HintedString<"top" | "bottom" | "both"> bottom 페이지네이터 위치예요. 'top', 'bottom', 'both' 중에서 고를 수 있어요.
alwaysShowPaginator boolean true 페이지가 하나뿐인 경우에도 표시할지 여부예요.
paginatorTemplate any FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown 페이지네이터 템플릿이에요. 미리 정의된 키를 사용해 template 프로퍼티로 커스터마이즈할 수 있어요. - FirstPageLink - PrevPageLink - PageLinks - NextPageLink - LastPageLink - RowsPerPageDropdown - JumpToPageDropdown - JumpToPageInput - CurrentPageReport
pageLinkSize number 5 표시할 페이지 링크 수예요.
rowsPerPageOptions number[] - 페이지별 행 수 드롭다운에 표시할 정수 값 배열이에요.
currentPageReportTemplate string '({currentPage} of {totalPages})' 현재 페이지 리포트 엘리먼트의 템플릿이에요. 페이지네이션 상태 정보를 표시해요. 사용할 수 있는 플레이스홀더는 다음과 같아요; - {currentPage} - {totalPages} - {rows} - {first} - {last} - {totalRecords}
lazy boolean false 데이터를 지연(lazy) 방식으로 로드하고 다루는지 정의해요.
loading boolean false 데이터 로드가 진행 중임을 알리는 로더를 표시해요.
loadingIcon string - 데이터 로드 진행 중에 표시할 아이콘이에요.
sortField keyof T | Function - 기본 정렬에 사용할 행 데이터의 프로퍼티 이름 또는 게터 함수예요.
sortOrder number - 데이터를 정렬할 기본 순서예요.
nullSortOrder number 1 null 값이 어떻게 정렬되는지 결정해요.
defaultSortOrder number 1 정렬되지 않은 컬럼의 기본 정렬 순서예요.
multiSortMeta DataTableSortMeta[] - 데이터를 정렬하는 데 사용할 SortMeta 객체 배열이에요.
sortMode HintedString<"single" | "multiple"> single 정렬이 단일 컬럼으로 동작하는지, 여러 컬럼으로 동작하는지 정의해요.
removableSort boolean false 켜면 컬럼이 정렬되지 않은 상태를 가질 수 있어요.
filters DataTableFilterMeta - 필터를 정의하는 키-값 쌍의 필터 객체예요.
filterDisplay HintedString<"menu" | "row"> - 필터 엘리먼트의 레이아웃이에요.
globalFilterFields (keyof T | Function)[] - 전역 필터링에 사용할 문자열 또는 함수 형태의 필드 배열이에요.
filterLocale string - 필터링에 사용할 로케일이에요. 기본 로케일은 호스트 환경의 현재 로케일이에요.
selection NoInfer | NoInfer[] - single 모드에서는 선택된 행, multiple 모드에서는 값의 배열이에요.
selectionMode HintedString<"single" | "multiple"> - 선택 모드를 지정해요.
compareSelectionBy HintedString<"equals" | "deepEquals"> deepEquals 행이 선택되었는지 판단하는 알고리즘이에요.
metaKeySelection boolean false 선택에 metaKey가 필요한지 정의해요. true면 항목을 선택하거나 해제할 때 metaKey를 눌러야 하고, false면 각 항목을 개별적으로 토글할 수 있어요. 터치 지원 기기에서는 metaKeySelection이 자동으로 꺼져요.
contextMenu boolean false 컨텍스트 메뉴 통합을 켜요.
contextMenuSelection NoInfer | NoInfer[] - ContextMenu와 함께 선택된 행 인스턴스예요.
selectAll Nullable - 모든 데이터가 선택되었는지 여부예요.
rowHover boolean false 켜면 행에 마우스를 올렸을 때 행 배경이 바뀌어요.
csvSeparator string , csv 구분자로 사용할 문자예요.
exportFilename string download 내보낼 파일의 이름이에요.
exportFunction Function -
resizableColumns boolean false 켜면 드래그 앤 드롭으로 컬럼 크기를 조절할 수 있어요.
columnResizeMode HintedString<"fit" | "expand"> fit 테이블 전체 너비의 동작 방식을 정의해요.
reorderableColumns boolean false 켜면 드래그 앤 드롭으로 컬럼 순서를 바꿀 수 있어요.
expandedRows null | DataTableExpandedRows | NoInfer[] - 펼쳐진 상태로 표시할 행 데이터 모음이에요.
expandedRowIcon string - 행이 펼쳐진 상태를 표시하는 행 토글러 아이콘이에요.
collapsedRowIcon string - 행이 접힌 상태를 표시하는 행 토글러 아이콘이에요.
rowGroupMode HintedString<"subheader" | "rowspan"> - 행 그룹 모드를 정의해요.
groupRowsBy keyof T | Function | (keyof T)[] - 행 그룹핑에 사용할 하나 이상의 필드 이름이에요.
expandableRowGroups boolean false 행 그룹을 펼치거나 접을 수 있는지 여부예요.
expandedRowGroups DataTableExpandedRows | NoInfer[] - 펼쳐진 상태로 렌더링될 그룹의 그룹 필드 값 배열이에요.
stateStorage HintedString<"session" | "local"> session 상태 저장 테이블이 상태를 어디에 보관하는지 정의해요.
stateKey string - 상태 저장소에서 사용할 상태 저장 테이블의 고유 식별자예요.
editMode HintedString<"row" | "cell"> - 인셀(incell) 편집 모드를 정의해요.
editingRows DataTableEditingRows | NoInfer[] - 행 편집 모드에서 현재 편집 중인 데이터를 나타내는 행 모음이에요.
rowClass Function -
rowStyle Function -
scrollable boolean false 지정하면 가로 및/또는 세로 스크롤이 켜져요.
scrollHeight HintedString<"flex"> - 스크롤 뷰포트의 높이예요. 고정 픽셀 값이나 동적 크기용 'flex' 키워드를 사용해요.
virtualScrollerOptions any - virtualScroller 기능 사용 여부예요. VirtualScroller 컴포넌트의 프로퍼티를 객체 형태로 넣을 수 있어요. 참고: 현재는 세로 방향 모드만 지원해요.
frozenValue null | NoInfer[] - 스크롤 가능한 DataTable에서 고정 부분의 항목들이에요.
breakpoint string 960px stack 반응형 레이아웃 사용 시 최대 너비 경계를 정의하는 브레이크포인트예요.
showHeaders boolean true 테이블 헤더를 표시할지 여부예요.
showGridlines boolean false 셀 사이에 그리드 선을 표시할지 여부예요.
stripedRows boolean false 행을 교대로 다른 색으로 표시할지 여부예요.
highlightOnSelect boolean false 첫 번째 항목을 자동으로 하이라이트해요.
size HintedString<"small" | "large"> - 테이블의 크기를 정의해요.
tableStyle string | object - table 엘리먼트의 인라인 스타일이에요.
tableClass string | object - table 엘리먼트의 스타일 클래스예요.
tableProps TableHTMLAttributes - TableHTMLAttributes의 모든 프로퍼티를 컴포넌트 내부의 table 엘리먼트에 전달할 때 사용해요.
filterInputProps InputHTMLAttributes - HTMLInputElement의 모든 프로퍼티를 컴포넌트 내부의 포커스 가능한 필터 입력 엘리먼트에 전달할 때 사용해요.
filterButtonProps Partial - 모든 필터 버튼 프로퍼티 객체를 전달해요.
editButtonProps DataTableEditButtonPropsOptions - 모든 편집 버튼 프로퍼티 객체를 전달해요.
dt any - 디자인 토큰으로 컴포넌트의 스코프 CSS 변수를 생성해요.
pt PassThrough - 컴포넌트 내부 DOM 엘리먼트에 속성을 전달할 때 사용해요.
ptOptions any - 컴포넌트의 passthrough(pt) 옵션을 구성할 때 사용해요.
unstyled boolean false 켜면 코어의 컴포넌트 관련 스타일을 제거해요.

Pass Through Options

이름 타입 설명
root DataTablePassThroughOptionType root DOM 엘리먼트에 속성을 전달할 때 사용해요.
mask DataTablePassThroughOptionType mask DOM 엘리먼트에 속성을 전달할 때 사용해요.
loadingIcon DataTablePassThroughOptionType loading icon DOM 엘리먼트에 속성을 전달할 때 사용해요.
header DataTablePassThroughOptionType header DOM 엘리먼트에 속성을 전달할 때 사용해요.
pcPaginator any Paginator 컴포넌트에 속성을 전달할 때 사용해요.
tableContainer DataTablePassThroughOptionType table container DOM 엘리먼트에 속성을 전달할 때 사용해요.
virtualScroller any VirtualScroller 컴포넌트에 속성을 전달할 때 사용해요.
table DataTablePassThroughOptionType table DOM 엘리먼트에 속성을 전달할 때 사용해요.
virtualScrollerSpacer DataTablePassThroughOptionType virtual scroller spacer DOM 엘리먼트에 속성을 전달할 때 사용해요.
footer DataTablePassThroughOptionType footer DOM 엘리먼트에 속성을 전달할 때 사용해요.
thead DataTablePassThroughOptionType thead DOM 엘리먼트에 속성을 전달할 때 사용해요.
headerRow DataTablePassThroughOptionType header row DOM 엘리먼트에 속성을 전달할 때 사용해요.
tbody DataTablePassThroughOptionType tbody DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowGroupHeader DataTablePassThroughOptionType row group header DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowGroupHeaderCell DataTablePassThroughOptionType row group header cell DOM 엘리먼트에 속성을 전달할 때 사용해요.
bodyRow DataTablePassThroughOptionType body row DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowExpansion DataTablePassThroughOptionType row expansion DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowExpansionCell DataTablePassThroughOptionType row expansion cell DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowGroupFooter DataTablePassThroughOptionType row group footer DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowGroupFooterCell DataTablePassThroughOptionType row group footer cell DOM 엘리먼트에 속성을 전달할 때 사용해요.
emptyMessage DataTablePassThroughOptionType empty message DOM 엘리먼트에 속성을 전달할 때 사용해요.
emptyMessageCell DataTablePassThroughOptionType empty message cell DOM 엘리먼트에 속성을 전달할 때 사용해요.
tfoot DataTablePassThroughOptionType tfoot DOM 엘리먼트에 속성을 전달할 때 사용해요.
footerRow DataTablePassThroughOptionType footer row DOM 엘리먼트에 속성을 전달할 때 사용해요.
columnResizeIndicator DataTablePassThroughOptionType column resize indicator DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowReorderIndicatorUp DataTablePassThroughOptionType row reorder indicator up DOM 엘리먼트에 속성을 전달할 때 사용해요.
rowReorderIndicatorDown DataTablePassThroughOptionType row reorder indicator down DOM 엘리먼트에 속성을 전달할 때 사용해요.
columnGroup any ColumnGroup 헬퍼 컴포넌트에 속성을 전달할 때 사용해요.
row any Row 헬퍼 컴포넌트에 속성을 전달할 때 사용해요.
column any Column 헬퍼 컴포넌트에 속성을 전달할 때 사용해요.
hooks any 모든 라이프사이클 훅을 관리할 때 사용해요.
transition DataTablePassThroughTransitionType Vue Transition API를 제어할 때 사용해요.

테마 (Theming)

CSS 클래스 (CSS Classes)

클래스 설명
p-datatable root 엘리먼트의 클래스 이름
p-datatable-mask mask 엘리먼트의 클래스 이름
p-datatable-loading-icon loading icon 엘리먼트의 클래스 이름
p-datatable-header header 엘리먼트의 클래스 이름
p-datatable-paginator-[position] paginator 엘리먼트의 클래스 이름
p-datatable-table-container table container 엘리먼트의 클래스 이름
p-datatable-table table 엘리먼트의 클래스 이름
p-datatable-thead thead 엘리먼트의 클래스 이름
p-datatable-column-resizer column resizer 엘리먼트의 클래스 이름
p-datatable-column-header-content column header content 엘리먼트의 클래스 이름
p-datatable-column-title column title 엘리먼트의 클래스 이름
p-datatable-sort-icon sort icon 엘리먼트의 클래스 이름
p-datatable-sort-badge sort badge 엘리먼트의 클래스 이름
p-datatable-filter filter 엘리먼트의 클래스 이름
p-datatable-filter-element-container filter element container 엘리먼트의 클래스 이름
p-datatable-column-filter-button column filter button 엘리먼트의 클래스 이름
p-datatable-column-filter-clear-button column filter clear button 엘리먼트의 클래스 이름
p-datatable-filter-overlay filter overlay 엘리먼트의 클래스 이름
p-datatable-filter-constraint-list filter constraint list 엘리먼트의 클래스 이름
p-datatable-filter-constraint filter constraint 엘리먼트의 클래스 이름
p-datatable-filter-constraint-separator filter constraint separator 엘리먼트의 클래스 이름
p-datatable-filter-operator filter operator 엘리먼트의 클래스 이름
p-datatable-filter-operator-dropdown filter operator dropdown 엘리먼트의 클래스 이름
p-datatable-filter-rule-list filter rule list 엘리먼트의 클래스 이름
p-datatable-filter-rule filter rule 엘리먼트의 클래스 이름
p-datatable-filter-constraint-dropdown filter constraint dropdown 엘리먼트의 클래스 이름
p-datatable-filter-remove-rule-button filter remove rule button 엘리먼트의 클래스 이름
p-datatable-filter-add-rule-button filter add rule button 엘리먼트의 클래스 이름
p-datatable-filter-buttonbar filter buttonbar 엘리먼트의 클래스 이름
p-datatable-filter-clear-button filter clear button 엘리먼트의 클래스 이름
p-datatable-filter-apply-button filter apply button 엘리먼트의 클래스 이름
p-datatable-tbody tbody 엘리먼트의 클래스 이름
p-datatable-row-group-header row group header 엘리먼트의 클래스 이름
p-datatable-row-toggle-button row toggle button 엘리먼트의 클래스 이름
p-datatable-row-toggle-icon row toggle icon 엘리먼트의 클래스 이름
p-datatable-row-expansion row expansion 엘리먼트의 클래스 이름
p-datatable-row-group-footer row group footer 엘리먼트의 클래스 이름
p-datatable-empty-message empty message 엘리먼트의 클래스 이름
p-datatable-reorderable-row-handle reorderable row handle 엘리먼트의 클래스 이름
p-datatable-row-editor-init row editor init 엘리먼트의 클래스 이름
p-datatable-row-editor-save row editor save 엘리먼트의 클래스 이름
p-datatable-row-editor-cancel row editor cancel 엘리먼트의 클래스 이름
p-datatable-tfoot tfoot 엘리먼트의 클래스 이름
p-datatable-virtualscroller-spacer virtual scroller spacer 엘리먼트의 클래스 이름
p-datatable-footer footer 엘리먼트의 클래스 이름
p-datatable-column-resize-indicator column resize indicator 엘리먼트의 클래스 이름
p-datatable-row-reorder-indicator-up row reorder indicator up 엘리먼트의 클래스 이름
p-datatable-row-reorder-indicator-down row reorder indicator down 엘리먼트의 클래스 이름

디자인 토큰 (Design Tokens)

토큰 CSS 변수 설명
datatable.transition.duration --p-datatable-transition-duration root의 전환(transition) 지속 시간
datatable.border.color --p-datatable-border-color root의 테두리 색상
datatable.header.background --p-datatable-header-background header의 배경
datatable.header.border.color --p-datatable-header-border-color header의 테두리 색상
datatable.header.color --p-datatable-header-color header의 색상
datatable.header.border.width --p-datatable-header-border-width header의 테두리 두께
datatable.header.padding --p-datatable-header-padding header의 패딩
datatable.header.sm.padding --p-datatable-header-sm-padding header의 작은(sm) 패딩
datatable.header.lg.padding --p-datatable-header-lg-padding header의 큰(lg) 패딩
datatable.header.cell.background --p-datatable-header-cell-background header cell의 배경
datatable.header.cell.hover.background --p-datatable-header-cell-hover-background header cell의 호버 배경
datatable.header.cell.selected.background --p-datatable-header-cell-selected-background header cell의 선택된 배경
datatable.header.cell.border.color --p-datatable-header-cell-border-color header cell의 테두리 색상
datatable.header.cell.color --p-datatable-header-cell-color header cell의 색상
datatable.header.cell.hover.color --p-datatable-header-cell-hover-color header cell의 호버 색상
datatable.header.cell.selected.color --p-datatable-header-cell-selected-color header cell의 선택된 색상
datatable.header.cell.gap --p-datatable-header-cell-gap header cell의 간격
datatable.header.cell.padding --p-datatable-header-cell-padding header cell의 패딩
datatable.header.cell.focus.ring.width --p-datatable-header-cell-focus-ring-width header cell의 포커스 링 두께
datatable.header.cell.focus.ring.style --p-datatable-header-cell-focus-ring-style header cell의 포커스 링 스타일
datatable.header.cell.focus.ring.color --p-datatable-header-cell-focus-ring-color header cell의 포커스 링 색상
datatable.header.cell.focus.ring.offset --p-datatable-header-cell-focus-ring-offset header cell의 포커스 링 오프셋
datatable.header.cell.focus.ring.shadow --p-datatable-header-cell-focus-ring-shadow header cell의 포커스 링 그림자
datatable.header.cell.sm.padding --p-datatable-header-cell-sm-padding header cell의 작은(sm) 패딩
datatable.header.cell.lg.padding --p-datatable-header-cell-lg-padding header cell의 큰(lg) 패딩
datatable.column.title.font.weight --p-datatable-column-title-font-weight column title의 폰트 두께
datatable.row.background --p-datatable-row-background row의 배경
datatable.row.hover.background --p-datatable-row-hover-background row의 호버 배경
datatable.row.selected.background --p-datatable-row-selected-background row의 선택된 배경
datatable.row.color --p-datatable-row-color row의 색상
datatable.row.hover.color --p-datatable-row-hover-color row의 호버 색상
datatable.row.selected.color --p-datatable-row-selected-color row의 선택된 색상
datatable.row.focus.ring.width --p-datatable-row-focus-ring-width row의 포커스 링 두께
datatable.row.focus.ring.style --p-datatable-row-focus-ring-style row의 포커스 링 스타일
datatable.row.focus.ring.color --p-datatable-row-focus-ring-color row의 포커스 링 색상
datatable.row.focus.ring.offset --p-datatable-row-focus-ring-offset row의 포커스 링 오프셋
datatable.row.focus.ring.shadow --p-datatable-row-focus-ring-shadow row의 포커스 링 그림자
datatable.row.striped.background --p-datatable-row-striped-background row의 줄무늬 배경
datatable.body.cell.border.color --p-datatable-body-cell-border-color body cell의 테두리 색상
datatable.body.cell.padding --p-datatable-body-cell-padding body cell의 패딩
datatable.body.cell.sm.padding --p-datatable-body-cell-sm-padding body cell의 작은(sm) 패딩
datatable.body.cell.lg.padding --p-datatable-body-cell-lg-padding body cell의 큰(lg) 패딩
datatable.body.cell.selected.border.color --p-datatable-body-cell-selected-border-color body cell의 선택된 테두리 색상
datatable.footer.cell.background --p-datatable-footer-cell-background footer cell의 배경
datatable.footer.cell.border.color --p-datatable-footer-cell-border-color footer cell의 테두리 색상
datatable.footer.cell.color --p-datatable-footer-cell-color footer cell의 색상
datatable.footer.cell.padding --p-datatable-footer-cell-padding footer cell의 패딩
datatable.footer.cell.sm.padding --p-datatable-footer-cell-sm-padding footer cell의 작은(sm) 패딩
datatable.footer.cell.lg.padding --p-datatable-footer-cell-lg-padding footer cell의 큰(lg) 패딩
datatable.column.footer.font.weight --p-datatable-column-footer-font-weight column footer의 폰트 두께
datatable.footer.background --p-datatable-footer-background footer의 배경
datatable.footer.border.color --p-datatable-footer-border-color footer의 테두리 색상
datatable.footer.color --p-datatable-footer-color footer의 색상
datatable.footer.border.width --p-datatable-footer-border-width footer의 테두리 두께
datatable.footer.padding --p-datatable-footer-padding footer의 패딩
datatable.footer.sm.padding --p-datatable-footer-sm-padding footer의 작은(sm) 패딩
datatable.footer.lg.padding --p-datatable-footer-lg-padding footer의 큰(lg) 패딩
datatable.drop.point.color --p-datatable-drop-point-color drop point의 색상
datatable.column.resizer.width --p-datatable-column-resizer-width column resizer의 너비
datatable.resize.indicator.width --p-datatable-resize-indicator-width resize indicator의 너비
datatable.resize.indicator.color --p-datatable-resize-indicator-color resize indicator의 색상
datatable.sort.icon.color --p-datatable-sort-icon-color sort icon의 색상
datatable.sort.icon.hover.color --p-datatable-sort-icon-hover-color sort icon의 호버 색상
datatable.sort.icon.size --p-datatable-sort-icon-size sort icon의 크기
datatable.loading.icon.size --p-datatable-loading-icon-size loading icon의 크기
datatable.row.toggle.button.hover.background --p-datatable-row-toggle-button-hover-background row toggle button의 호버 배경
datatable.row.toggle.button.selected.hover.background --p-datatable-row-toggle-button-selected-hover-background row toggle button의 선택 호버 배경
datatable.row.toggle.button.color --p-datatable-row-toggle-button-color row toggle button의 색상
datatable.row.toggle.button.hover.color --p-datatable-row-toggle-button-hover-color row toggle button의 호버 색상
datatable.row.toggle.button.selected.hover.color --p-datatable-row-toggle-button-selected-hover-color row toggle button의 선택 호버 색상
datatable.row.toggle.button.size --p-datatable-row-toggle-button-size row toggle button의 크기
datatable.row.toggle.button.border.radius --p-datatable-row-toggle-button-border-radius row toggle button의 테두리 반경
datatable.row.toggle.button.focus.ring.width --p-datatable-row-toggle-button-focus-ring-width row toggle button의 포커스 링 두께
datatable.row.toggle.button.focus.ring.style --p-datatable-row-toggle-button-focus-ring-style row toggle button의 포커스 링 스타일
datatable.row.toggle.button.focus.ring.color --p-datatable-row-toggle-button-focus-ring-color row toggle button의 포커스 링 색상
datatable.row.toggle.button.focus.ring.offset --p-datatable-row-toggle-button-focus-ring-offset row toggle button의 포커스 링 오프셋
datatable.row.toggle.button.focus.ring.shadow --p-datatable-row-toggle-button-focus-ring-shadow row toggle button의 포커스 링 그림자
datatable.filter.inline.gap --p-datatable-filter-inline-gap filter의 인라인 간격
datatable.filter.overlay.select.background --p-datatable-filter-overlay-select-background filter의 오버레이 select 배경
datatable.filter.overlay.select.border.color --p-datatable-filter-overlay-select-border-color filter의 오버레이 select 테두리 색상
datatable.filter.overlay.select.border.radius --p-datatable-filter-overlay-select-border-radius filter의 오버레이 select 테두리 반경
datatable.filter.overlay.select.color --p-datatable-filter-overlay-select-color filter의 오버레이 select 색상
datatable.filter.overlay.select.shadow --p-datatable-filter-overlay-select-shadow filter의 오버레이 select 그림자
datatable.filter.overlay.popover.background --p-datatable-filter-overlay-popover-background filter의 오버레이 popover 배경
datatable.filter.overlay.popover.border.color --p-datatable-filter-overlay-popover-border-color filter의 오버레이 popover 테두리 색상
datatable.filter.overlay.popover.border.radius --p-datatable-filter-overlay-popover-border-radius filter의 오버레이 popover 테두리 반경
datatable.filter.overlay.popover.color --p-datatable-filter-overlay-popover-color filter의 오버레이 popover 색상
datatable.filter.overlay.popover.shadow --p-datatable-filter-overlay-popover-shadow filter의 오버레이 popover 그림자
datatable.filter.overlay.popover.padding --p-datatable-filter-overlay-popover-padding filter의 오버레이 popover 패딩
datatable.filter.overlay.popover.gap --p-datatable-filter-overlay-popover-gap filter의 오버레이 popover 간격
datatable.filter.rule.border.color --p-datatable-filter-rule-border-color filter의 rule 테두리 색상
datatable.filter.constraint.list.padding --p-datatable-filter-constraint-list-padding filter의 constraint list 패딩
datatable.filter.constraint.list.gap --p-datatable-filter-constraint-list-gap filter의 constraint list 간격
datatable.filter.constraint.focus.background --p-datatable-filter-constraint-focus-background filter의 constraint 포커스 배경
datatable.filter.constraint.selected.background --p-datatable-filter-constraint-selected-background filter의 constraint 선택 배경
datatable.filter.constraint.selected.focus.background --p-datatable-filter-constraint-selected-focus-background filter의 constraint 선택 포커스 배경
datatable.filter.constraint.color --p-datatable-filter-constraint-color filter의 constraint 색상
datatable.filter.constraint.focus.color --p-datatable-filter-constraint-focus-color filter의 constraint 포커스 색상
datatable.filter.constraint.selected.color --p-datatable-filter-constraint-selected-color filter의 constraint 선택 색상
datatable.filter.constraint.selected.focus.color --p-datatable-filter-constraint-selected-focus-color filter의 constraint 선택 포커스 색상
datatable.filter.constraint.separator.border.color --p-datatable-filter-constraint-separator-border-color filter의 constraint 구분선 테두리 색상
datatable.filter.constraint.padding --p-datatable-filter-constraint-padding filter의 constraint 패딩
datatable.filter.constraint.border.radius --p-datatable-filter-constraint-border-radius filter의 constraint 테두리 반경
datatable.paginator.top.border.color --p-datatable-paginator-top-border-color paginator 상단의 테두리 색상
datatable.paginator.top.border.width --p-datatable-paginator-top-border-width paginator 상단의 테두리 두께
datatable.paginator.bottom.border.color --p-datatable-paginator-bottom-border-color paginator 하단의 테두리 색상
datatable.paginator.bottom.border.width --p-datatable-paginator-bottom-border-width paginator 하단의 테두리 두께

더 알아보기 (Learn more)

value와 Column 조합만으로 기본 테이블이 만들어지고, 정렬·필터·선택·페이지네이션 같은 동작은 대응하는 props와 이벤트로 하나씩 확장하는 구조예요. 실제 프로퍼티 이름과 기본값은 위의 Props 표를 참고하세요.