Hello,
I'm trying to retain the value of the combobox on action error. After the user selects an option from the combobox, I run a database query to check if the option selected is valid, if not, I want the previous option to stay selected. Example: Combobox value = "N/A", user selects "COMPLETED", db check fails, combobox value should be 'N/A". I add the code below, hope to get some help with this.
Thanks,
Carla
<kendo-combobox id="complete-button" (click)="$event.stopImmediatePropagation()" [data]="stateListDictionary[task.id]" [value]="stateListComboDefaultDict[task.id]" [placeholder]="'Change State...'" (valueChange)="updateTaskStatePerExperiment($event, task, experiment)" [disabled]="stateListComboDisabledDict[task.id]"></kendo-combobox>if (taskId === 17) { // Pre Review task needs an extra check this.checklistApiService.getPreReviewTrackValue(this.expId).subscribe(data => { let dataLength = data.length; if (dataLength != 0) { //there is a track value set, so it's ok to change this.updateTaskHelper(taskId, status, taskItem, experimentItem); } else { //there is no track value if (status != 'COMPLETED') { //setting status other than Completed is ok this.updateTaskHelper(taskId, status, taskItem, experimentItem); } else { //status is 'Completed' so throw error this.stateListComboDefaultDict[taskItem.id] = "TEST"; // this.populateCategoryChildren(this.gateId); // @TODO find a better way to clear 'COMPLETED' and keep the previous value that should not change let toast:Toast = { type: 'error', title: 'Task status could not be updated', body: 'The task could not be updated. Please select a Review Track in the Pre Review tab', showCloseButton: true }; this.toasterService.pop(toast); } } }, err =>{ console.log("Request Service Error => [getPreReviewTrackValue in gate-checklist page] generated while getting review track " + err); return false; }); } else { this.updateTaskHelper(taskId, status, taskItem, experimentItem); }