on 11-10-2017 10:28 AM
Hi,
I have created a table and bind json data into it. I have to perform add and delete operations. Add operation works fine. For delete operation, I have used mode="Delete".
For this I have added a function in my controller.
the controller code is
onDelete: function(oEvent) {
var item = oEvent.getParameter("listItem");
var path = item.getBindingContext().getPath();
var idx = parseInt(path.substring(path.lastIndexOf('/') + 1), 10);
var table = this.getView().byId("idProductsTable");
var model = table.getModel();
var data = model.getData();
data.splice(idx, 1);
model.setData(data);
}
I am getting error as ----- data.splice is not a function
By using the below code,
onDelete: function(evt) {
evt.getSource().removeItem(evt.getParameter("listItem"));
}
I can able to delete the row. But again when i try to add a new entry it's showing error as---- Error: adding element with duplicate id '__text5-__xmlview0--idProductsTable-1'
Please help me with this.
Thanks,
Janani
Hi Janani ,
Please check whether Table object is returned correctly .
Also just keep a debugger and check if there is any data "data" array if this is not so then you need to check the binding of table .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what path does you bind the rows to?
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
make sure the data is array....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.