I’m trying to implement the closing event handler, and get the closed tab ids.
layout = [
{
type: ‘LayoutGroup’,
orientation: ‘horizontal’,
items: [
{
type: ‘LayoutGroup’,
items: [
{
type: ‘LayoutPanel’,
id: ‘tabPanel’,
label: ‘Input’,
tabCloseButtons:true,
items: [
{
id: 1,
label: ‘TextBox Tab’,
content: ”,
},
{
id: 2,
label: ‘Slider Tab’,
content: ”,
},
],
size: ‘50%’,
},
],
orientation: ‘vertical’,
size: ‘50%’,
},
],
},
];
this.dockingLayout.addEventListener(‘closing’, (event: Event) => {
const customEvent = <CustomEvent>event;
console.log(customEvent);
//LayoutPanel with multiple tabs closed
if (event.srcElement.items) {
event.srcElement.items.forEach((tab: any) => {
console.log(tab.id);
});
} else {
//LayoutPanelItem closed, singular tab
//event.tabId?
}
});
If I close the panel named “Input”, I can get the tab objects from the event parameter (event.srcElement.items).
If I close individual tabs, I cannot find the closed tab’s id from the event parameter.
Also, srcElement is deprecated, is there another way to get the LayoutPanel object and its items?
Thank you