poplau
30 Aug 2007, 8:14 AM
I use Ie6,I found memory impove Rapidly when i clicked button to show extjs's dialog.memory add 1M size every clicking.i guess it's memory leaks,how can i prevent it?thanks!
this is my code:
<div id="message-dlg" style="visibility:hidden;position:absolute;top:0px;">
<div class="x-dlg-hd" id="msg-title"></div>
<div class="x-dlg-bd" >
<ul style="text-align:center;margin-bottom:10px;display:none;" id="msgintro">
<li style="color:#aaaaaa;border:solid 1px #75C1E7;width:95%;height:70px;">
xxxxxxxx();
</li>
</ul>
<div style="width:350px;">
<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
<div id="form-ct">
</div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>
</div>
</div>
var dialogmsg,showBtnmsg
function MessageToShouxi(bt,type){
showBtnmsg = Ext.get(bt);
if(!dialogmsg){ // lazy initialize the dialog and only create it once
dialogmsg = new Ext.BasicDialog("message-dlg", {
autoTabs:false,
width:380,
height:230,
shadow:true,
minWidth:330,
minHeight:200,
resizable:false,
proxyDrag: true
});
}
if(type=="shenqing"){
$get('msgintro').style.display="block";
dialogmsg.setTitle("linkone");
dialogmsg.resizeTo(380,320);
}else{
$get('msgintro').style.display="none";
dialogmsg.resizeTo(380,230);
dialogmsg.setTitle("linktow");
}
//dialogmsg.addKeyListener(27, dialogmsg.hide, dialogmsg);
dialogmsg.show(showBtnmsg.dom);
}
Ext.onReady(function(){
Ext.QuickTips.init();
// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
/*
* ================ Simple form =======================
*/
var simple = new Ext.form.Form({
labelWidth: 75//, // label settings here cascade unless overridden
//url:'save-form.php'
});
var mytitle,mycontent;
simple.add(
my = new Ext.form.TextField({
fieldLabel: 'mtitle',
name: 'first',
width:200,value:'',
allowBlank:false
}),
mycontent = new Ext.form.TextArea({
fieldLabel: 'mcontent',
name: 'address',
grow: false,
width:225,
height:100,
preventScrollbars:true,
value: ''
})
);
simple.addButton('isend',function (){
Ext.MessageBox.alert('xxxx',' xxxx ',function (){
dialogmsg.hide();
});
});
simple.addButton('iclose',function (){
dialogmsg.hide();
});
simple.render('form-ct');
});
this is my code:
<div id="message-dlg" style="visibility:hidden;position:absolute;top:0px;">
<div class="x-dlg-hd" id="msg-title"></div>
<div class="x-dlg-bd" >
<ul style="text-align:center;margin-bottom:10px;display:none;" id="msgintro">
<li style="color:#aaaaaa;border:solid 1px #75C1E7;width:95%;height:70px;">
xxxxxxxx();
</li>
</ul>
<div style="width:350px;">
<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
<div id="form-ct">
</div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>
</div>
</div>
var dialogmsg,showBtnmsg
function MessageToShouxi(bt,type){
showBtnmsg = Ext.get(bt);
if(!dialogmsg){ // lazy initialize the dialog and only create it once
dialogmsg = new Ext.BasicDialog("message-dlg", {
autoTabs:false,
width:380,
height:230,
shadow:true,
minWidth:330,
minHeight:200,
resizable:false,
proxyDrag: true
});
}
if(type=="shenqing"){
$get('msgintro').style.display="block";
dialogmsg.setTitle("linkone");
dialogmsg.resizeTo(380,320);
}else{
$get('msgintro').style.display="none";
dialogmsg.resizeTo(380,230);
dialogmsg.setTitle("linktow");
}
//dialogmsg.addKeyListener(27, dialogmsg.hide, dialogmsg);
dialogmsg.show(showBtnmsg.dom);
}
Ext.onReady(function(){
Ext.QuickTips.init();
// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';
/*
* ================ Simple form =======================
*/
var simple = new Ext.form.Form({
labelWidth: 75//, // label settings here cascade unless overridden
//url:'save-form.php'
});
var mytitle,mycontent;
simple.add(
my = new Ext.form.TextField({
fieldLabel: 'mtitle',
name: 'first',
width:200,value:'',
allowBlank:false
}),
mycontent = new Ext.form.TextArea({
fieldLabel: 'mcontent',
name: 'address',
grow: false,
width:225,
height:100,
preventScrollbars:true,
value: ''
})
);
simple.addButton('isend',function (){
Ext.MessageBox.alert('xxxx',' xxxx ',function (){
dialogmsg.hide();
});
});
simple.addButton('iclose',function (){
dialogmsg.hide();
});
simple.render('form-ct');
});