How to clear dialog/xmlfragment content after close?

前端 未结 3 1165
闹比i
闹比i 2021-01-29 04:45

My dialog is defined as document:

  onOpenDialog : function () {
     var oView = this.getView();
     var oDialog = oView.byId(\"helloDialog\");
     // create         


        
3条回答
  •  余生分开走
    2021-01-29 05:16

    /***********************************/
    onOpenAddEmployeeDialog: function () {
        var oView = self.getView()
        var oDialog = oView.byId('addEmployeeFragment');
    
        if ((oDialog = !null)) {
           var oDialog = sap.ui.xmlfragment(oView.getId(), 'sap.ui.view.AddEmployeeFragment'
           oView.addDependent(oDialog);
        }
    
        var dialogModel = new JSONModel();
        oDialog.setModel(dialogModel, 'dialog');
        oDialog.open();
    
    },
    /***********************************/           
    
    
    /***********************************/
     dialogAfterClose: function () {
        var oView = self.getView()
        var oDialog = oView.byId('addEmployeeFragment');
    
        //clear dialog Data
        var oDialogData = oDialog.getModel('dialog').getData();
        Object.getOwnPropertyNames(oDialogData).forEach(function(d) {
             oDialogData[d] = 
         });
    
       dialogModel.setData(oDialogData);
       oDialog.close();
       oDialog.destroy();
    },
    /***********************************/
    

    *AddEmployee.fragment.xml

    
      
        
          

提交回复
热议问题