Showing results for 
Search instead for 
Did you mean: 

Removing Panel Completely from layout

Former Member
0 Kudos

Hi All,

I have an functionality to create nested panel one inside the other, when I click on any of the panel it should remove the panel with their children in it. I have create the panel as given below and added an click event using the panel button and tried to remove the panel from the parent panel. I have used the removeContent(0), removeAllContent(0) for removing the current panel where the click event is fired. this removes the content alone not the panel, when I try to add an panel in the layout (nested), The panel I removed earlier is loading back with the newly created panel. Please help me to add an functionality to remove the panel section on click of the button on the panel header.

my ui logic is as below.

Panel 1--------

     Panel 2-----------

          Panel 3-------------

               Panel 4--------------

When I remove panel 3 --- panel 3 & panel 4 should be removed. when I remove the panel 1 all the panels rendered below should be removed. the below is the code I have used to remove the panel

sap.ui.getCore().byId("CurrentPanelId read from click event").removeAllContent(0);

Thanks in Advance.

View Entire Topic
Former Member
0 Kudos

Hello Srn,

Maybe you can try to use the destroy() function on your object so it should look like that:

sap.ui.getCore().byId("the id you got from your click event").destroy();

This should completely remove the Panel.

Best Regards


Former Member
0 Kudos

.destroy(); did the trick... Thank you....

Active Contributor
0 Kudos

I think it is better to delete it too.

var oPanel = sap.ui.getCore().byId("the id you got from your click event");


delete oPanel;