on 06-24-2015 12:05 PM
Hi all,
i am using sap.m table i am attaching attachDelete for table like below
oTable.setMode(sap.m.ListMode.Delete);
oTable.attachDelete(function(oEvent){
debugger;
var oSelectedItem = oEvent.getParameter("listItem");
var path = oEvent.getParameter('listItem').getBindingContext().sPath;
var obj = oTable.getModel().getProperty(path);
console.log(obj); // here is the object ot be deleted
var delrowId = oSelectedItem.getBindingContext().sPath.slice(oSelectedItem.getBindingContext().sPath.lastIndexOf('/')+1);
var objstr = JSON.stringify(obj);
oTable.getModel().getData().rows.splice(parseInt(delrowId), 1);
oTable.removeItem(oEvent.getParameter('listItem'));
amlvalues =sap.ui.getCore().getModel('mainModel').oData.MaintenanceLevels;
for(var i=0;i<amlvalues.length;i++)
{
if(JSON.stringify(amlvalues[i]) === objstr){
if(amlvalues[i].Updkz==='I'){
sap.ui.getCore().getModel('mainModel').oData.MaintenanceLevels.splice(i,1);
console.log(Index);
}else{
amlvalues[i].Updkz = 'D';
}}
}
});
attach delete event raising if i am clicking one delete icon it will raise multiple times and den deleting all rows followed by the delted row.
Thanks,
Kotesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
i am attaching event to table so i think some problem with attaching.
now i am moved to Multi select and then user clicks delete button and then i am getting the selected records and then lopping on that i am doing my own logic to handle that..
i am removing those records from the table model and then again binding the model to the table so now my problem is solved with other way.
Thanks,
Kotesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Select 1 unique item. means "ID" will be different in 1 item to another Like that ,..
var obj = oEvent.getSource().getBindingContext("Table Item Binded Ref Name").getObject();
var idDelete = obj.ID;
var amlvalues =sap.ui.getCore().getModel('mainModel').oData.MaintenanceLevels;
for (var int = 0; int < amlvalues.length; int++)
{
var idArray = amlvalues[int].ID;
if(idArray == idDelete )
{
aDataItems.SalesOrderItems.splice(int, 1);
int = int -1;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.