Fixed #1042 - DataTable "select all checkbox" and "export csv" exclude frozen rows

pull/1073/head
Cagatay Civici 2021-03-10 12:36:09 +03:00
parent 301781e3e0
commit 7c9e6234c7
1 changed files with 8 additions and 8 deletions

View File

@ -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() {