on 01-21-2022 1:33 PM
I have a table to which I am showing data from the model.
when I click on split button, a new row gets added.
Now if I change data in any 1 input field, all the input fields gets updated, and also the SubItem No is remaining same for all the rows, when I add new row the numbering will update for all. don't know what is wrong.
order qty, received qty unit is same for all the rows. posting qty and Batch will be different.
Below is the code I've written for model and to add new row when clicked on split button.
_getModelAndBindData: function() {
this._aBatchItem = [];
// first get the global model
let oBatchItemModel = sap.ui.getCore().getModel("batchItem").getProperty("/");
console.log(oBatchItemModel);
oBatchItemModel.Postingquantity = "";
let SubItemno = parseInt(oBatchItemModel.SubItemno);
if (SubItemno === 0) {
oBatchItemModel.SubItemno = 0;
oBatchItemModel.SubItemno += 1;
}
this._aBatchItem.push(oBatchItemModel);
let itemJsonModel = new JSONModel({
results: this._aBatchItem
});
this.getView().byId("id_BatchSplit_table").setModel(itemJsonModel, "itemJsonModel");
},
onBatchSplitButtonPress: function(oEvent) {
let oTableControlRef = oEvent.getSource().getParent().getParent();
let oItemJsonModel = oTableControlRef.getModel("itemJsonModel");
let localData = oItemJsonModel.getProperty("/results");
this._aBatchItem[0].SubItemno = this._getUniqueSubItemno(oEvent);
let oNewRow = this._aBatchItem[0];
localData.push(oNewRow);
oItemJsonModel.setProperty("/results", localData);
},
seems you are pushing same object again and again.
this._aBatchItem.push(oBatchItemModel);
put the new item in a object, then push
var newItem={}//fill it
then
this._aBatchItem.push(
newItem
);You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Issue: when you change the input box value the data in all the rows suddenly become same.
Suggestion: if my understanding is correct then shouldn't you check the change event of your input control. Can you check the code for the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.