Added fix for #1044

This commit is contained in:
Vito Albano
2016-11-11 00:53:34 +00:00
parent 8195c00c74
commit 38b61a4f64
6 changed files with 163 additions and 45 deletions

View File

@@ -34,25 +34,52 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
ngOnInit() {
if (this.field && this.field.restUrl) {
this.formService
.getRestFieldValues(
this.field.form.taskId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
let options = [];
if (this.field.emptyOption) {
options.push(this.field.emptyOption);
}
this.field.options = options.concat((result || []));
this.field.updateForm();
},
this.handleError
);
if (this.field.form.processDefinitionId) {
this.getValuesByProcessDefinitionId();
} else {
this.getValuesByTaskId();
}
}
}
getValuesByTaskId() {
this.formService
.getRestFieldValues(
this.field.form.taskId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
let options = [];
if (this.field.emptyOption) {
options.push(this.field.emptyOption);
}
this.field.options = options.concat((result || []));
this.field.updateForm();
},
this.handleError
);
}
getValuesByProcessDefinitionId() {
this.formService
.getRestFieldValuesByProcessId(
this.field.form.processDefinitionId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
let options = [];
if (this.field.emptyOption) {
options.push(this.field.emptyOption);
}
this.field.options = options.concat((result || []));
this.field.updateForm();
},
this.handleError
);
}
handleError(error: any) {
console.error(error);
}