sapui5 batch with sap.ui.model.odata.v2.ODataModel -




i created table data using jsonmodel

    var omodel = new sap.ui.model.json.jsonmodel(query);     otableprio = sap.ui.getcore().getcontrol("idtableprio2");     otableprio.setmodel(omodel, "prio2");  

everythink , work good.

now have added new column(prio) change value. after changing save every rows( in sap ztable ) after clicking buton save . made this

var omodel = new sap.ui.model.odata.v2.odatamodel(gserviceurl);         omodel.setusebatch(true);         (var = 0; < data.length; i++) {             sentry.matnr = data[i].matnr;             sentry.bbynr = data[i].bbynr;             sentry.prio = data[i].prio;  omodel.update("/wielosztset('"+data[i].bbynr+"')", sentry, {                   method: "put",  function(){                 alert('data updated successfully');                  location.reload(true);                   },function(){                         sap.m.messagetoast.show('update failed',{duration:1000});                    }}); } 

now sends data last row. wrote cannot update more 1 row in way , need make batch. connot find how create working batch uploding data sap.ui.model.odata.v2.odatamodel

please give me advice.

before call of omodel.update assign usebatch true:

omodel.setusebatch(true); 

make for:

for (var = 0; < data.length; i++) {             sentry.matnr = data[i].matnr;             sentry.bbynr = data[i].bbynr;             sentry.prio = data[i].prio;  omodel.update("/wielosztset('"+data[i].bbynr+"')", sentry, {                   method: "put",  function(){                 alert('data updated successfully');                  location.reload(true);                   },function(){                         sap.m.messagetoast.show('update failed',{duration:1000});                    }}); } 

at end of put submitchanges.

omodel.submitchanges(); omodel.setusebatch(false); // make false if reuse omodel. 

regards.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -