From 7c9e6234c702116ec944eef4ccec0985b2a91187 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 10 Mar 2021 12:36:09 +0300 Subject: [PATCH] Fixed #1042 - DataTable "select all checkbox" and "export csv" exclude frozen rows --- src/components/datatable/DataTable.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index 9be350a21..5a6404496 100755 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -815,7 +815,7 @@ export default { toggleRowsWithCheckbox(event) { const processedData = this.processedData; const checked = this.allRowsSelected; - const _selection = checked ? [] : (processedData ? [...processedData] : [...this.value]); + const _selection = checked ? [] : (this.frozenValue ? [...this.frozenValue, ...processedData]: processedData); this.$emit('update:selection', _selection); if (checked) @@ -931,9 +931,10 @@ export default { let data = this.processedData; let csv = '\ufeff'; - if (options && options.selectionOnly) { + if (options && options.selectionOnly) data = this.selection || []; - } + else if (this.frozenValue) + data = data ? [...this.frozenValue, ...data] : this.frozenValue; //headers let headerInitiated = false; @@ -1707,7 +1708,7 @@ export default { }, processedData() { if (this.lazy) { - return this.value; + return this.value || []; } else { if (this.value && this.value.length) { @@ -1726,9 +1727,8 @@ export default { return data; } - else { - return null; - } + + return []; } }, dataToRender() { @@ -1768,7 +1768,7 @@ export default { return ['p-datatable-loading-icon pi-spin', this.loadingIcon]; }, allRowsSelected() { - const val = this.processedData; + const val = this.frozenValue ? [...this.frozenValue, ...this.processedData]: this.processedData; return (val && val.length > 0 && this.selection && this.selection.length > 0 && this.selection.length === val.length); }, attributeSelector() {