Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Add row (on client-side) to table using ODATAModel

$
0
0

Hi there,

 

I got a Table bound to an ODATAModel.

I want to create a Button that inserts a new row to the table (and this record should not be saved to the database yet), and after that the user should enter the data to the new row and press a save button. After pressing save the record should be saved to the database.

 

Here's a sample what is exactly doing what I want, but it's using a JSONModle: http://jsbin.com/uxokuc/421/edit

 

I've came up with that, which adds a new record but also send it to the DB directly:

 

btnAddRecord.attachPress(function() {    // tblUser.addRow(new sap.ui.table.Row()); NOT POSSIBLE    var newEntry = oData.createEntry('/tbl_user', {ID: 4711, USERNAME: 'BEN'});    console.log(newEntry.getObject().USERNAME)    oData.submitChanges(local);
});

Some ideas here how (and if) that is possible?

 

Many thanks,

ben


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>