Skip to Content

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

SAPUI5 page View reload issue

Hi Experts,

          I have created an app that has a view that shows graph. The graph will be rendered in a view called CompareEmpChart this VIEW i rendered in

a dialog. so that i call call the same view from multiple places. that means the graph rendering in this CompareEmpChart view inside dialog is

dynamic. so my problem is when use this call this view from any page at  it will work properly but only for the first time. That means second time when

I call the same view it won't open the dialog until I reload the page. I dont know what is the issue...

SECOND TIME MY DIALOG IS NOT GETTING OPENED UNTIL I RELOAD THE VIEW. BUT FROM THE SAME VIEW MY DIALOG WILL OPEN MULTIPLE TIME BUT WHEN I CALL THE SAME VIEW FROM ANY OTHER VIEW IT WON'T OPEN THE DIALOG UNTIL I RELOAD

//////////////// below is my code to open the dialog

var cmpEmpChart = sap.ui.view({viewName:"myApp.uplan.view.CompareEmpChart",type:sap.ui.core.mvc.ViewType.XML});

     

if(typeof dialog === "undefined") {

            dialog = new sap.m.Dialog({

                 id : "idCustomDialog",

                 showHeader:false,

                 contentWidth : Math.round(window.screen.availWidth * 1) +"px" ,

                 contentHeight : Math.round(window.screen.availHeight * 1) +"px",

                 content : cmpEmpChart,

                 endButton: new sap.m.Button({

                     text: 'Close',

                     type:"Reject",

                     press: function () {

                         that.getView().getModel('emp').refresh();

                         compareEmp = { };

                         sap.ui.getCore().byId("lb2").rerender();

                         that.renderItems();

                         dialog.close();

                 }

             }),

            });

            that.getView().addDependent(dialog);

       }

       //dialog.addStyleClass('hideHeader');

       dialog.open();

Former Member
replied

The problem is while reloading, if the previous content is not destroyed, while trying create new one, it will give duplicate id error as you cannot have 2 UI with same id.

Please just check in debugging mode. This is just my guess for your error. We can confirm once you see it by debugging.

With Regards,

Ramesh Shrestha

0 View this answer in context

Helpful Answer

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