cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 ui.table with SmartField on JSONModel

axeldion
Explorer
0 Kudos
88

Hello, 

I have an interesting requirement. I want to create a table where my users can add new records. For this I use a sap.ui.table with input fields. This table has a binding with a JSONModel to store the new records. My oData Service has Annotations to generate value helps so I would like to add SmartFields in my table so I can re-use these value helps. So there are 2 options I think:

1. Can I use regular input fields in my sap.ui.table with generated value helps from my annotations? 

2. Can I put SmartFields in my table that uses a JSONModel to "write" my values but uses oData to retrieve valuehelp annotations? 

Thanks!

axeldion_0-1719232395226.png

Best regards,

Axel Dion 

EDIT:
Currently I have the following and this works when I perform .bindValue("helperModel>/newCharacteristics/0/SalesOrganization") manually on each of the fields. This is because the bindings mode is changed to two way binding. Although my models are TwoWay the binding is set on OneWay when only using the XML. Any ideas why this is happening?

axeldion_0-1719245153705.png

 

View Entire Topic
Lidia-Sarasua
Explorer
0 Kudos

If you have a formatter, the binding automatically changes to one way binding (bear in mind that a formatter function such as your testFormatter takes care of formatting the value stored in the model and process it to show it to the user in a specific way, but it doesn't know how to take the user input and process it to store it in the model).

With the bindValue you're removing the formatter piece. 

This xml should be equivalent to your manual .bindvalue.

LidiaSarasua_0-1719316581447.png