#1058 fix typehead

This commit is contained in:
Mario Romano
2016-11-11 18:26:02 +00:00
parent b985c51333
commit ee1c717092

View File

@@ -147,6 +147,37 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit {
} }
loadRestFieldValue() { loadRestFieldValue() {
if (this.field.form.processDefinitionId) {
this.getValuesByProcessDefinitionId();
} else {
this.getValuesByTaskId();
}
}
getValuesByProcessDefinitionId(){
this.formService
.getRestFieldValuesByProcessId(
this.field.form.processDefinitionId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
let options = result || [];
let toSelect = options.find(item => item.id === this.field.value);
if (toSelect) {
this.value = toSelect.name;
} else {
this.value = this.field.value;
}
},
error => {
console.log(error);
this.value = this.field.value;
}
);
}
getValuesByTaskId() {
this.formService this.formService
.getRestFieldValues(this.field.form.taskId, this.field.id) .getRestFieldValues(this.field.form.taskId, this.field.id)
.subscribe( .subscribe(