PDA

View Full Version : EXTJS3.4 : Uncaught TypeError: Cannot read property 'parentNode' of undefined



shruthi123
30 Dec 2014, 2:54 AM
HI

If we are closing a tabPanel using closable: true, the default action will be destroying the tabPanel. And so, since the tabPanel is destroyed we wont be able to display the tabPanel again. But, I do not want the tabPanel to be destroyed, it has to be hidden so I tried this


this.Manage = new Ext.TabPanel({
title: 'Manage',
closable: true,
closeAction: 'hide',
activeTab: 0,
items:[
this.manageGridPanel


]
});


What happens with this is, I am able to display the tabPanel but the child elements within that are not being displayed. And I am getting following exception in js console Uncaught TypeError: Cannot read property 'parentNode' of undefined Also because of this, I am not able to navigate to other tabpanels from my treepanel, I am getting the following exception in js console Uncaught TypeError: Cannot read property 'className' of undefined .


I also tried using the beforeclose event like this in the tabpanel

listeners: {
'beforeclose': function(panel) {
console.log('TP - beforeclose');
var closeAction = this.ownerCt.closeAction
if (closeAction === 'hide') {
panel.hide();
var el = Ext.get(panel.tabEl);
el._savedWidth = el.getWidth();
el.setWidth(0);
el.setVisible(false);
return false;
}
return true;
}
}


This is how I open the tab panel dynamically,


if(n.text=='Manage')
{
that.hometabPanel.add(manage.Manage).show();
}

Should I give tab.setVisible(true) ?or what changes should I make for this to work??

Gary Schlosberg
30 Dec 2014, 9:55 AM
I'm not seeing this issue in my tests. Any chance you can post a test case showing your tabpanel so we can see what might be happening?

shruthi123
31 Dec 2014, 11:20 PM
That is so much of code, there are 2 or 3 levels of tabpanels.. :( that is why I reduced it to the main content required and created the post.. But I can brief u on what has been done..

I have the main page( the application home page) for which I am using border layout to have a tree panel and tab panel mainly.
Based on the different nodes selected, I need to open different tabs in the tabpanel. And every tab that I add, will again be a tabpanel (that.Manage in this case) which contains a menu and a grid initially. Based on the item chosen in the menu, I add different tabs as child element of manage tabpanel.
I am able to get the application display all the tabs successfully. But, the issue is that, when I close the manage tabpanel and try to re-open manage tabpanel by clicking on a treenode 2nd time. the manage tabpanel is being displayed since I have used hide. But, the child elements which is the grid and the menu are not being rendered and I get the exception that I have mentioned in the post telling Uncaught TypeError: Cannot read property 'parentNode' of undefined
Also,after trying to open manage tabpanel 2nd time, if I try to open any other tabs from the tree, I get an exception telling Uncaught TypeError: Cannot read property 'className' of undefined.