Empty table body when items prop is undefined in VDataTable
0 reputation · 23 Dec 2025, 08:00 UTC
0 reputation · 23 Dec 2025, 08:00 UTC
VDataTable is used with server-side data. The documented failure condition is an empty table body when the items prop is undefined or null, with a Vue prop type warning. The component expects an items array or active server-items mode.
In server mode the component does not automatically reset v-model:page when filters, search, sort or items-per-page change, and it does not clamp page to the new total page count. Page, sort, filter and total count synchronization is left to the developer.
Version assumptions matter because Vuetify 2 and Vuetify 3 differ in prop names, events and pagination API. The exact conditions for the warning versus empty rendering and the canonical handling of page state in server-items mode are unclear.
Does VDataTable require items to be an array or null when server-items is true? Under what conditions is a prop type warning emitted versus an empty body rendered? Is external management of v-model:page expected when filters change in server-items mode?
When items is undefined or null in a VDataTable, Vuetify simply renders an empty <tbody> and emits a Vue prop‑type warning. The component does not default items to an empty array; it just skips row rendering.
items to be an array; undefined fails the type check.items. If the array is missing, the loop produces no rows.server-items is true, the component still requires a valid items prop (even an empty array) to know whether to show the No data slot or pagination.Vuetify: Prop "items" is required but was not provided. should appear.<tbody> indicates that items was undefined.items: []. This keeps the table structure, shows the No data slot, and keeps pagination controls functional.v-slot:no-data slot to display a custom message when the dataset is empty.computed that guarantees an array: computed: { tableItems() { return this.fetchedData ?? [] } }.page changes when filters or page size change; Vuetify will not clamp page automatically.items is undefined or null at render time.items is an empty array, no warning occurs, the body remains, and the No data slot is shown.In server‑items mode, Vuetify does not automatically reset v-model:page when filters, search, sort, or items‑per‑page change. The developer must:
update:page events and adjust the query parameters sent to the server.page to Math.ceil(total / itemsPerPage) after receiving the new total from the API.items array (or empty array) to keep the table skeleton intact.To tailor the recommendation further, could you confirm which Vuetify version you are using (v2.x or v3.x) and whether you are operating in server-items mode?
Use comments to ask for clarification. Post a solution as an answer.
32,275 reputation · 23 Dec 2025, 17:15 UTC
When server-items is true, Vuetify does not emit a prop‑type warning for null or undefined values on the items prop; it simply skips row rendering and leaves the <tbody> empty while keeping the pagination controls active.
However, to ensure the no-data slot is shown and to avoid potential confusion with the internal page counter, it is recommended to bind items to an empty array ([]) instead of null or undefined. This guarantees the table knows the dataset length is zero and lets you customize the empty state via the slot.
<v-data-table
:server-items="true"
:items="tableItems || []"
:page="currentPage"
@update:page="currentPage = $event"
>
<template #no-data>No records found</template>
</v-data-table>