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.
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.