cancel
Showing results for 
Search instead for 
Did you mean: 

Add new row to a table after introducing new data in other view.

mdiez
Participant
0 Kudos

Hi experts,

I have a huge problem  because I am not able to find data in order to do that.

This what I need to do:

I have a Table in the View ("view1) wich is displaying data from DataModel. Then I press a button which navigate to another view ("view2) where I have to add new data. Once I have added the data I press a button which call a event ("onAdd") in order to store the data using  jQuery.sap.storage.Type.session. (I do this way because I don't want to create new data in the data model unless another confirm button had been pressed).


So now, I would like to know if its possible to add a new row in the table on the view (view1) displaying the new data when onAdd event (which is in the view2 controller) is triggered. When I go back to the view1 I should be able to see the new row with the new data added.


I don't know how to bind the action of a event in the view2 whose results have to be displayed in the view1 and where I have to write the code in order to add the row.



Thanks in advance,


Marcos.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marcos,

I'm afraid it's not possible to add a row in way you want.

To add row you have to add the new entry to the data model underneath your table but as you described it's not possible due to your confirmation process.

Maybe you can add a whole new 'columns' to your data model indicating the status of each entry so you can add the new entry with a status like 'pending' preventing your business logic to process the new one till it's status has been changed?

Greetz,

Silvio

mdiez
Participant
0 Kudos

Hi Silvio, thanks for your answer.

I would like to ask something.

If I have all in the same view could I asocciate the event of stored the data and the event off adding the new row? Maybe when I press the button to store the new data I add a new row which read the information stored  and finally refresh the view to display it.

If not I'll do it what you said before.

Thanks Silvio.

Regards.

Marcos.

Former Member
0 Kudos

I don't know about an event at adding a new row you can tying on some custom code. I'm just remembering my trouble with manipulating table content without touching the data model.

Found no solution without getting really awkward.

Sorry bro.

junwu
Active Contributor
0 Kudos

why not possible?

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

just push an element to the array which is bound to the table. that's it.