fieldset with multiplicity

This commit is contained in:
annampak 2017-11-16 11:46:31 +02:00
parent 16fd7a8c88
commit 2c45254e53
2 changed files with 26 additions and 20 deletions

View File

@ -159,6 +159,7 @@ export class DatasetsComponent implements OnInit {
} }
getDatasets(muted?: boolean){ getDatasets(muted?: boolean){
this.spinnerService.show();
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe( this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
response => { response => {
this.tableData = response; this.tableData = response;
@ -167,6 +168,9 @@ export class DatasetsComponent implements OnInit {
}, },
error => { error => {
simple_notifier("danger",null,"Could not update datasets table"); simple_notifier("danger",null,"Could not update datasets table");
},
() =>{
this.spinnerService.hide();
} }
); );
} }

View File

@ -181,26 +181,28 @@ export class dataModelBuilder {
} else { } else {
//this.dataModel.fields.push(field); //this.dataModel.fields.push(field);
} }
if (dataValues[fieldGroup._id][field.key] != undefined){ //TO DO FIELDSET WITH MULTIPLICITY
let keys = new Array<string>(); // if (dataValues != "")
Object.keys(dataValues[fieldGroup._id]).forEach(key=>{if(key.startsWith(field.key+"_"))keys.push(key)}) // if (dataValues[fieldGroup._id][field.key] != undefined){
if (keys.length) // let keys = new Array<string>();
if (field.controlType == "textbox") { // Object.keys(dataValues[fieldGroup._id]).forEach(key=>{if(key.startsWith(field.key+"_"))keys.push(key)})
let newfield: FieldBase<any>; // if (keys.length)
let rule = new Rule(); // if (field.controlType == "textbox") {
newfield = new TextboxField({ // let newfield: FieldBase<any>;
label: field.label+"_"+ 1, // let rule = new Rule();
key: keys[0], // newfield = new TextboxField({
value: dataValues[fieldGroup._id][keys[0]].value, // label: field.label+"_"+ 1,
order: field.order, // key: keys[0],
rules: field.rules, // value: dataValues[fieldGroup._id][keys[0]].value,
visible: field.visible, // order: field.order,
group: field.group, // rules: field.rules,
description: field.description // visible: field.visible,
});debugger; // group: field.group,
newfldGroup.groupFields.push(newfield); // description: field.description
} // });debugger;
} // newfldGroup.groupFields.push(newfield);
// }
// }