}
} else if (field.datatype == 'org_unit') {
let org = rec[field.name]();
- if (org != null && typeof org == 'object') {
+ if (org && typeof org == 'object') {
rec[field.name](org.id());
}
}
// Apply a default org unit value when none is set.
// First tries workstation org unit, then user home org unit.
+ // An onChange event WILL be generated when a default is applied.
@Input() applyDefault: boolean = false;
-
// List of org unit IDs to exclude from the selector
@Input() set hideOrgs(ids: number[]) {
if (ids) this.hidden = ids;
this.selected = this.formatForDisplay(
this.org.get(this.auth.user().ws_ou())
);
+
+ // avoid notifying mid-digest
+ setTimeout(() => this.onChange.emit(this.startOrg), 0);
}
if (this.startOrg) {