【发布时间】:2019-10-04 00:23:40
【问题描述】:
我有一个剑道下拉列表,我在更改下拉值之前显示一个对话框确认框。它工作正常,但是尽管在 dailog 框中做了任何事情,但下拉值正在发生变化,我如何才能停止在下拉列表上更改值。
我的带有 valueChange 事件的下拉列表。
<kendo-dropdownlist required [data]="responseTypes"
[defaultItem]="{responseTypeID: null, responseTypeName: 'Select Response Type'}"
[textField]="'responseTypeName'"
[valueField]="'responseTypeID'"
name="responseTypeId"
[(ngModel)]="selectedResponseType"
(valueChange)="responseTypeChange($event, this)"
#responseTypeIdVar="ngModel" class="form-control" style="width:180px;">
responseTypeChange 方法
public responseTypeChange(value: any, data: any): void {
let changeResponseType: boolean = false;
if (this.oldResponseTypeValue != undefined) {
const dialog: DialogRef = this.dialogService.open({
title: "Primary Insights",
content: "Changing response type will remove the options filled, Do you want to continue?",
actions: [
{ text: "No" },
{ text: "Yes", primary: true }
],
width: 520,
minWidth: 250
});
dialog.result.subscribe((result) => {
if ((result as any).text === "Yes") {
//changeResponseType = true;
this.initializeResponseType(value);
}
if ((result as any).text === "No") {
//changeResponseType = true;
this.selectedResponseType = this.oldResponseTypeValue;
this.multipleChoiceResponse.multipleChoiceOptionsArray = data.multipleChoiceResponse.multipleChoiceOptionsArray;
}
});
}
}
【问题讨论】:
标签: angular kendo-ui kendo-ui-angular2 kendo-dropdown