Skip to Content

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

Dialog Screen is working on first time but not at all time.

Hello expert,

While I'm developing my project I add a button which is calling a dialog screen but on first time its working perfect. But If I want to press the button one more time there is a error like this: "Uncaught Error: The object with ID pddepLayout1 was destroyed and cannot be used anymore."

Please help this situation.

Here is my all code :

var opddepButton1 = new sap.m.Button('opddepButton1',{text:'Ekle',

  press:function(oEvent){

  oDialog.setBindingContext(oEvent.oSource

            .getBindingContext());

  openDialog();

    }

   

    });

                

               

  function openDialog() {

       oDialog.destroyContent();

  

    var opddepButton = new sap.m.Button('opddepButton',{text:'Ekle',press:function(){

    

    

            var fname = sap.ui.getCore().byId('pdmalkod').getValue();

            var lname = sap.ui.getCore().byId('pdparti').getValue();

            var aname = sap.ui.getCore().byId('pdmiktar').getValue();

            var bname = sap.ui.getCore().byId('pdolcbir').getValue();

            var cname = sap.ui.getCore().byId('pdmasyer').getValue();

            var dname = sap.ui.getCore().byId('pdnedekod').getValue();

           

            mdData.clients.push({"id":fname,"parti":lname,"miktar":aname,"olcbirimi":bname,"masyeri":cname,"nedkodu":dname });

            oModel.setData(mdData);

           

            oDialog.close();

           

           

           

           

            }

           

            });

    var labelidmalkod = new sap.m.Label('labelidmalkod',{text:'Malzeme Kodu:'

           

        });

        var pdmalkod = new sap.m.Input('pdmalkod',{

       

        });

       var labelidparti = new sap.m.Label('labelidparti',{text:'Parti:'

       

        });

       var pdparti = new sap.m.Input('pdparti',{

       

        });

      

       var labelidmiktar = new sap.m.Label('labelidmiktar',{text:'Miktar:'

          

       });

      var pdmiktar = new sap.m.Input('pdmiktar',{

      

       });

     

      var labelidolcbir = new sap.m.Label('labelidolcbir',{text:'Ölçü Birimi:'

       

      });

     var pdolcbir = new sap.m.Input('pdolcbir',{

     

      });

    

     var labelidmasyer = new sap.m.Label('labelidmasyer',{text:'Masraf Yeri:'

       

     });

    var pdmasyer = new sap.m.Input('pdmasyer',{

    

     });

    

    var labelidnedkod = new sap.m.Label('labelidnedkod',{text:'Neden Kodu:'

       

    });

    var pdnedekod = new sap.m.Input('pdnedekod',{

    

    });

      

     pddepLayout1.createRow(labelidmalkod, pdmalkod);

      

     pddepLayout1.createRow(labelidparti, pdparti);

    

     pddepLayout1.createRow(labelidmiktar, pdmiktar);

    

     pddepLayout1.createRow(labelidolcbir, pdolcbir);

    

     pddepLayout1.createRow(labelidmasyer, pdmasyer);

    

     pddepLayout1.createRow(labelidnedkod, pdnedekod);

     pddepLayout1.createRow(opddepButton);

    

     oDialog.addContent(pddepLayout1);

    

    

    

     oDialog.open();

  

    };

Thanks,

Ogulcan G.

Tags:
Former Member
replied

Ogulcan,

Check this sample, which is bit similar to your requirement: Plunker

Click on Edit, you will get the details of row and when you're closing the dialog, it just says sap.ui.getCore().byId("yourDialogID").destroy();

Regards,

Sai Vellanki.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question