Skip to content

Commit

Permalink
Fixed #1042 - DataTable "select all checkbox" and "export csv" exclud…
Browse files Browse the repository at this point in the history
…e frozen rows
  • Loading branch information
cagataycivici committed Mar 10, 2021
1 parent 301781e commit 7c9e623
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1707,7 +1708,7 @@ export default {
},
processedData() {
if (this.lazy) {
return this.value;
return this.value || [];
}
else {
if (this.value && this.value.length) {
Expand All @@ -1726,9 +1727,8 @@ export default {
return data;
}
else {
return null;
}
return [];
}
},
dataToRender() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7c9e623

Please sign in to comment.