PDA

View Full Version : Simple code result in orphan id? (code,html,jpg attached)



alwayscy
15 Sep 2009, 10:49 PM
I shrink my large number code for check memory leak, but at last, I found even the simplest code result in orphan id, could you help me?
I create a formpanel in a tabpanel, and tabpanel in a viewport.
Checking with sIEve, the form created everytime will be orphaned.



test1.js:



function init() {
var uptab = new Ext.TabPanel({
id : 'uptab',
autoDestroy : true,
enableTabScroll : true,
layoutOnTabChange : true,
listeners : {},
defaults : {},
activeTab : 0,
items : []
});

var gid = 0;

var tool = new Ext.Toolbar({
id : 'tool',
border : false,
items : [{
text : 'Toggle Me',
xtype : 'button',
handler : function() {
gid = gid+1;
uptab.add(new Ext.FormPanel({
id : 'orphan_form_'+gid,
title : 'host',
closable : true
})).show();
}
}]
});

var viewport = new Ext.Viewport({
layout : 'border',
id : 'viewport',
hideBorders : true,
items : [new Ext.Panel({
bodyBorder : false,
border : false,
layout : 'fit',
region : 'north',
cls : 'docs-header',
height : 26,
items : tool
}), {
region : 'center',
layout : 'border',
hideBorders : true,
items : [{
region : 'center',
contentEl : 'uptabs',
layout : 'fit',
margins : '0 5 0 0',
height : 700,
items : uptab
}]
}]
});
}





<html>
<head>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />

<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->

<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="./test1.js"></script>

</head>
<body>
<script type="text/javascript">
Ext.onReady(init);
</script>
<body>
<div id="north" />
<div id="west" />
<div id="uptabs"></div>
<div id="downtabs" />
</body>
</html>



16227

alwayscy
16 Sep 2009, 6:16 AM
could some one give me some clue where to free form id nested in viewport?
Thanks!