I have a view, using sap.ui.table which has an editable vkorg column , these column is bound to a myModel4 model
XML view:
<u:Table rows="{myModel4>/BacklogHeaderSet}" busy="false" id="table40" rowMode="Interactive" cellClick="onCellClick" >
<u:Column width="11rem" sortProperty="Vkorg" filterProperty="Vkorg">
<Label text="Vkorg."/> <!-- The vkorg column -->
<u:template>
<Input xmlns="sap.m" value="{myModel4>Vkorg}" id="input41" valueLiveUpdate="true" liveChange="onChange" submit="onSubmit"/>
</u:template>
</u:Column>
myModel4 is not created by default. There is a bind button when I press it will create the myModel4 model dynamically:
onBind: function() {
var oModel = new sap.ui.model.odata.v2.ODataModel("/sap/opu/odata/sap/ZBAJUSZ_ODATA_BACKLOG_SRV/", {
defaultOperationMode: sap.ui.model.odata.OperationMode.Client
});
oModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);
var myTable = this.getView().byId("table40");
myTable.setBusy(true);
oModel.read("/BacklogHeaderSet", {
success: function(response) {
myTable.setBusy(false);
}.bind(this),
error: function() {
myTable.setBusy(false);
}
});
this.getView().setModel(oModel, "myModel4");
},
The model has a 2 way binding mode, and the input cell has valueLiveUpdate="true".
My problem is that when I change the value of the Vkorg cell, the myModel4 value is not updated. It always contains the old value.
What can be the problem? Thanks for the help.
I tried to check the data after Submit and change event of the input field, but myModel4 not updated automatically,
I put a button on the screen, and on the press event I get the model values and write it into the console:
onLoopSO: function () { //Looping all entries of the table (binded to myModel4)
var oModel = this.getView().getModel("myModel4");
var oData = oModel.oData;
var oRecord;
var oTable = Object.getOwnPropertyNames(oData);
for (var i = 0; i < oTable.length; i++) {
oRecord = oTable[i];
console.log(oData[oRecord].Vbeln, oData[oRecord].Posnr, oData[oRecord].Vkorg);
}
},