TODO: consider if there are cases where we're OK not
clearing the field, e.g., if both the previous
and new fields both have the same type. Note
that just clearing the value is what the Dojo
interface did.
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
</div>
<div class="row" *ngFor="let t of searchTerms">
<div class="col-lg-3">
- <select class="form-control" id="selected-search-term" [ngModelOptions]="{standalone: true}" [(ngModel)]="t.field">
+ <select class="form-control" id="selected-search-term" [ngModelOptions]="{standalone: true}" [(ngModel)]="t.field"
+ (change)="clearSearchTerm(t)">
<option disabled="disabled" i18n>Select Search Field</option>
<optgroup *ngFor="let g of hints" label="{{availableSearchFields[g]['__label']}}">
<option *ngFor="let o of availableSearchFields[g]['__fields']" value="{{g}}:{{o}}">
addSearchTerm() {
this.searchTerms.push({ field: '', op: '', value1: '', value2: '' });
}
+ clearSearchTerm(term: AcqSearchTerm) {
+ term.value1 = '';
+ term.value2 = '';
+ term.is_date = false;
+ }
setOrgUnitSearchValue(org: IdlObject, term: AcqSearchTerm) {
if (org == null) {
// handle supplied search terms
this._terms.forEach(term => {
- if (term.value1 === '') return;
+ if (term.value1 === '') {
+ return;
+ }
const searchTerm: Object = {};
const recType = term.field.split(':')[0];
const searchField = term.field.split(':')[1];