Skip to Content
0
Former Member
Jan 30, 2016 at 03:13 PM

Problem with element binding

41 Views

Hi all,

I am new to SAPUI5 development and I have a question regarding element binding. I have a table which shows all entries of an Hana table when the user clicks an entry it gets selected and the user then has the option to click on the "edit", "delete" or "add" button. In all cases a pop-up dialog is shown with a form where the selected record values gets binded on the right form elements. For this I have on each field an value entry written as follows: "value="{masterdata>CUSTOMER}"" where masterdata is my model name.

Now when the user does a Edit or Delete everything works fine (all values filled in the fields and saving changes back to database also works). However when the user does an "add" the system will not show any entries since we need to start fresh, but whenever you write something in a textfield (sap.m.Input) or change a dropdown entry (sap.m.select) it will remove the entry when you leave the input field. I tried to remove the value binding from one of the fields as a test and then I can change that specific field (the other fields containing the binding still clears the input after leaving the input field.

When I select an entry from the table and click on the edit button it will show the pop-up dialog with all entries filled in. When I then save it or cancel it and click on the add button after that it works. So after something was binded it will allow to change the entries, but when I then save the new entry and perform a model refresh it will save the new entry indeed to the database and it will update the table on the screen with the new value, but also the entry I clicked before to do an edit will get these new values on the table. This is only on the model though because after a refresh that entry gets the old value back again.

So although I did manage to bind a selected value in the form element without writing any JavaScript code for the binding itself, it does seem to give issues when there is no value to bind. Am I missing something here or does anyone know what is happening?

Kind Regards,

Nico van der Linden