combobox, render, bug fixes etc
This commit is contained in:
parent
0f90e6f56d
commit
88ae57bfbb
|
@ -17,9 +17,8 @@ export class AutocompleteComponent implements OnInit{
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
this.data.type= "autocomplete";
|
this.data.type= "autocomplete";
|
||||||
let autocomplete: AutocompleteData = new AutocompleteData();
|
let autocomplete: AutocompleteData = new AutocompleteData();
|
||||||
this.dataModel.data = new JsonSerializer<AutocompleteData>().fromJSONObject(this.data,AutocompleteData);
|
//this.dataModel.data = new JsonSerializer<AutocompleteData>().fromJSONObject(this.data,AutocompleteData);
|
||||||
//(<FormArray>this.form.get("data")).push(autocomplete.buildForm());
|
//(<FormArray>this.form.get("data")).push(autocomplete.buildForm());
|
||||||
if (this.form.get("data")) this.form.removeControl("data");
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
this.form.addControl("data", this.data.buildForm());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>Type of Combobox</label>
|
<label>Type of Combobox</label>
|
||||||
<select class="form-control" [(ngModel)]="dataModel.data!=null?dataModel.data.type:type">
|
<select class="form-control" [(ngModel)]="type" (change)= "onchangeCombo($event)">
|
||||||
<option *ngFor="let option of options" [value]="option.value">{{option.value}}</option>
|
<option *ngFor="let option of options" [value]="option.value">{{option.value}}</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="form-row" [ngSwitch]="dataModel.data!=null?dataModel.data.type:type">
|
<div class="form-row" [ngSwitch]="type">
|
||||||
<div *ngSwitchCase="'autocomplete'">
|
<div *ngSwitchCase="'autocomplete'">
|
||||||
<autocomplete-component [form]="form" [dataModel]="dataModel"></autocomplete-component>
|
<autocomplete-component [form]="form" [dataModel]="dataModel"></autocomplete-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row" [ngSwitch]="dataModel.data!=null?dataModel.data.type:type">
|
<div class="form-row" [ngSwitch]="type">
|
||||||
<div *ngSwitchCase="'wordlist'">
|
<div *ngSwitchCase="'wordlist'">
|
||||||
<wordlist-component [form]="form" [dataModel]="dataModel"></wordlist-component>
|
<wordlist-component [form]="form" [dataModel]="dataModel"></wordlist-component>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,10 +9,17 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||||
export class ComboboxComponent implements OnInit{
|
export class ComboboxComponent implements OnInit{
|
||||||
@Input() dataModel: Field;
|
@Input() dataModel: Field;
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
|
type: string;
|
||||||
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
|
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
|
if (this.dataModel.data){
|
||||||
|
this.type = this.form.get("data").get("type").value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onchangeCombo(){
|
||||||
|
if (this.form.get("data")) this.form.removeControl("data");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -18,9 +18,10 @@ export class WordlistComponent implements OnInit{
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
this.data.type = "wordlist";
|
this.data.type = "wordlist";
|
||||||
if (this.form.get("data")) this.form.removeControl("data");
|
// if (this.form.get("data")) this.form.removeControl("data");
|
||||||
this.form.addControl("data", this.data.buildForm());
|
this.form.addControl("data", this.data.buildForm());
|
||||||
this.addNewRow();
|
if(!this.dataModel.data)
|
||||||
|
this.addNewRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewRow(){
|
addNewRow(){
|
||||||
|
|
Loading…
Reference in New Issue