Skip to Content
0
Feb 02, 2016 at 03:09 PM

UI5 JSON data binding for textfields in a simple Form

345 Views

Experts,

I have employee data in JSON format(text file attached). I am using sap.ui.layout.form.Form to display the employee’s First Name. Currently I have 3 employees in the file. My question is how can dynamically show the employee's First Name in the form fields. By dynamically I mean, I don’t want to use the code that I am currently using below to display data against the “value” in the text field? Can I substitute the path that is used against the “value” say, by a variable such as employee id , and can display first name?

new sap.ui.layout.form.FormContainer({

formElements: [

new sap.ui.layout.form.FormElement({

fields: [new sap.ui.commons.TextField({

value: "{/employees/employee/0/firstName}",

width: "50px"

})

Attachments

Capture.JPG (19.2 kB)