Hello
in my project i am importing data in a smart table from an Excel file .
my smart table is editable but when i try to submit the changes nothing is happening and no batch call is done.
this is my smart table looks like:

end this is my save function : the toast Message is shown but nothing happens . and even when i see the Network , nothing happend
onSave: function () {
var oModel = that.byId("smartTab").getModel();
oModel.setUseBatch(true);
that._setBusy(true);
var fnSuccess = function (data, response) {
that._setBusy(false);
var sMessage = that._getText("changesSentMessage");
MessageToast.show(sMessage);
that._setUIChanges(false);
};
var fnError = function (e) {
that._setBusy(false);
that._setUIChanges(false);
MessageBox.error(e.message);
};
oModel.submitChanges({
success: fnSuccess,
error: fnError
});
that._bTechnicalErrors = false;
},
Request clarification before answering.
Hi Ibtissem,
Please check if you the change is collected with help of function, oModel.hasPendingChanges()
or oModel.getPendingChanges().
If the pending changes has collected the changes you have done, the on submitChanges, it should ideally trigger a backend call.
If no changes collected then either your table binding is not two-way or it is not at all binded to the model.
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ibtissem,
submitChanges will be logical work for oDataModel.
In brief, oDataModel resides on server side model, when you do a change in the data binded to the oDataModel, the changes are collected in the context and when you do submitChange, it will send those changes to the backend system.
JSONModel, usually do not require all these steps, it will right away update your JSONModel.
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ibtissem,
Since you are using JSONModel, then it's obvious there would not be any network call. JSONModel, is a client model, which means it will be built at the browser side and have no connection to the backend. Whatever you change will be directly updated to your JSONModel data because of two-way binding and that is the reason you will always see pending changes as false.
I hope it clarifies your question.
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello thank you for your response .
in my project i am using smart table with json model . when i used hasPendingChanges i am getting false .
this is my code how i binded data to smart table and it works.
var oModelMNA = new sap.ui.model.json.JSONModel();
oModelMNA.setData(json);
that.getView().setModel(oModelMNA, "oModelMNA");
var oTable = oSmartTab.getTable();
var aColumns = oTable.getColumns();
for (var m = 0; m < aColumns.length; m++)
{
var sPath ="oModelMNA>"+aColumns[m].data("p13nData").columnKey;
aColumns[m].getTemplate().getDisplay().bindText(sPath);
aColumns[m].getTemplate().getEdit().bindValue(sPath);
}
oTable.bindRows("oModelMNA>/");
var d= oSmartTab.getModel().getPendingChanges();the d viariable is getting empty .
my model is TwoWay binding.
i tried to use this tutorial because in need to show an excel file in a smart table .
https://blogs.sap.com/2019/06/26/enable-crud-operations-in-smart-table-sapui5/
thank youu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.