[英]i am using "ng-multiselect-dropdown" but when i select list selected values is shown in input side of dropdown
This is html of multiselect-dropdownList
这是多选下拉列表的 html
i am using "ng-multiselect-dropdown" but when i select list selected values is shown in input side of dropdown我正在使用“ng-multiselect-dropdown”但是当我 select 列表选择的值显示在下拉列表的输入侧
<div class="multiselect-dropdownList">
<[![ng-multiselect-dropdown][1]][1]
required
name="city"
[placeholder]="'VendorList'"
[data]="designerList"
[settings]="dropdowDesiner"
(onSelect)="onChangeDesignerList($event)"
(onSelectAll)="onChangeDesignerList($event)"
(onDeSelect)="onChangeDesignerList($event)"
(onDropDownClose)="onDropDownClose()"
>
</ng-multiselect-dropdown>
</div>
</div>
If You are using ng-multiselect-dropdown then all records must be show in input field如果您使用的是 ng-multiselect-dropdown,则所有记录都必须显示在输入字段中
You can use css to hide this.您可以使用 css 来隐藏它。 eg.ng-select /deep/ select-dropdown.selected { display: none }
eg.ng-select /deep/ select-dropdown.selected { display: none }
you can bind a variable, which contains elements you want to preselect, something like this:您可以绑定一个变量,其中包含您要预选的元素,如下所示:
equals(objOne, objTwo) {
if (typeof objOne !== 'undefined' && typeof objTwo !== 'undefined') {
return objOne.id === objTwo.id;
}
}
selectAll(checkAll, select: NgModel, values) {
//this.toCheck = !this.toCheck;
if(checkAll){
select.update.emit(values);
}
else{
select.update.emit([]);
}
}
[(ngModel)]="selectedYears" [compareWith]="equals" [multiple]= true
And then you can just filter your initial array of items and get only those, which you want to select by default (it should be stored in selection class property in provided case).然后您可以过滤您的初始项目数组并仅获取那些默认情况下您想要 select 的项目(在提供的情况下,它应该存储在选择 class 属性中)。
I have used the disabled:true property to disable it and to hide the dropdown I have used the class .multiselect-dropdown {.dropdown-list { display: none;important; } }
我使用 disabled:true 属性来禁用它并隐藏下拉列表 我使用了 class
.multiselect-dropdown {.dropdown-list { display: none;important; } }
.multiselect-dropdown {.dropdown-list { display: none;important; } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.