diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index ceb063447..bc10c7b5e 100644 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -847,24 +847,29 @@ export default { return []; }, processedData() { - if (this.value && this.value.length) { - let data = this.value; - - if (this.sorted) { - if(this.sortMode === 'single') - data = this.sortSingle(data); - else if(this.sortMode === 'multiple') - data = this.sortMultiple(data); - } - - if (this.hasFilters) { - data = this.filter(data); - } - - return data; + if (this.lazy) { + return this.value; } else { - return null; + if (this.value && this.value.length) { + let data = this.value; + + if (this.sorted) { + if(this.sortMode === 'single') + data = this.sortSingle(data); + else if(this.sortMode === 'multiple') + data = this.sortMultiple(data); + } + + if (this.hasFilters) { + data = this.filter(data); + } + + return data; + } + else { + return null; + } } }, dataToRender() { @@ -888,7 +893,8 @@ export default { } }, empty() { - return (!this.value || this.value.length === 0); + const data = this.processedData; + return (!data || data.length === 0); }, paginatorTop() { return this.paginator && (this.paginatorPosition !== 'bottom' || this.paginatorPosition === 'both'); diff --git a/src/views/datatable/DataTableDoc.vue b/src/views/datatable/DataTableDoc.vue index a4e0fbc61..1b23a5f60 100644 --- a/src/views/datatable/DataTableDoc.vue +++ b/src/views/datatable/DataTableDoc.vue @@ -318,7 +318,7 @@ export default {

Lazy loading is implemented by handling pagination, sorting and filtering using their own page, sort and filter events in addition to enabling lazy property. Here is a sample paging implementation with in memory data.

+ @@ -86,6 +89,9 @@ <MultiSelect v-model="filters['color']" :options="colors" optionLabel="name" optionValue="value" placeholder="Select a Color" /> </template> </Column> + <template #empty> + No records found. + </template> </DataTable> diff --git a/src/views/datatable/DataTableLazyDemo.vue b/src/views/datatable/DataTableLazyDemo.vue index df338283a..1ed28df91 100644 --- a/src/views/datatable/DataTableLazyDemo.vue +++ b/src/views/datatable/DataTableLazyDemo.vue @@ -13,7 +13,7 @@
- @@ -27,7 +27,7 @@