Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

AttachDelete event in sap.m.table raising multiple times

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.

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question