on 08-08-2018 3:28 PM
Hi,
My requirement is to delete the treetable row while clicking cancel button..This is my press function code.
onDelete:function(evt)
{
var sPath = evt.getSource().getBindingContext().getPath();
var oObj = this.getView().getModel().getObject(sPath);
console.log();
sPath.remove();
this.getView().getModel().refresh();
}
Here I am getting error like remove of undefined.
Can anyone help ?
Thanks,
Rahul
Hi Rahul,
sPath is a String, so sPath.remove() will fail anyway,
moreover, if the Model has a name, you should call .getBindingContext('modelname').getPath()
Sergei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
place a breakpoint after yougot sObj and oberve it. sObj will bei some sort of JSON Object.
if you want to remove the element from the model, use ...getModel("demoModel").remove(sPAth)
see more in documentation: https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataModel/methods/remove
if you need to submit the changes to the backend, you will also need something like ...getModel("demoMOdel").submitChanges()
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.