pull/104/head
Merve Özçifçi 2019-09-23 14:53:19 +03:00
parent c0f4784946
commit c76a5de4b9
1 changed files with 11 additions and 7 deletions

View File

@ -284,7 +284,7 @@ export default {
return label; return label;
}, },
onToggleAll(event) { onToggleAll(event) {
const value = this.allSelected ? [] : this.visibleOptions; const value = this.allSelected ? [] : this.visibleOptions && this.visibleOptions.map(option => this.getOptionValue(option));
this.$emit('input', value); this.$emit('input', value);
this.$emit('change', {originalEvent: event, value: value}); this.$emit('change', {originalEvent: event, value: value});
@ -311,7 +311,7 @@ export default {
'p-multiselect-label', 'p-multiselect-label',
{ {
'p-placeholder': this.label == null && this.placeholder, 'p-placeholder': this.label == null && this.placeholder,
'p-multiselect-label-empty': !this.placeholder 'p-multiselect-label-empty': !this.placeholder && (!this.value || this.value.length === 0)
} }
]; ];
}, },
@ -337,12 +337,16 @@ export default {
allSelected() { allSelected() {
if (this.filterValue && this.filterValue.trim().length > 0) { if (this.filterValue && this.filterValue.trim().length > 0) {
let allSelected = true; let allSelected = true;
if(this.visibleOptions.length > 0) {
for (let option of this.visibleOptions) { for (let option of this.visibleOptions) {
if (!this.isSelected(option)) { if (!this.isSelected(option)) {
allSelected = false; allSelected = false;
break; break;
} }
} }
}
else
allSelected = false;
return allSelected; return allSelected;
} }
else { else {