PDA

View Full Version : window hide problem



leon.wood
17 Mar 2011, 6:41 PM
Hi,
When I open Legend Window and click close try to hide it,there's also a blue area not hide.and throws a error.I can't find where is wrong....anyone could help me?thanks very much.

Ext.onReady(function(){
var win;
var lgwin;
var Lform = new Ext.form.FormPanel({
id:'Ltab',
layout:'absolute',
height: 201,
items:[
{xtype: 'label',text: 'Style:',x: 10,y: 12},
{id:'lstyle',xtype: 'combo',x: 70,y: 5,width: 120, triggerAction: 'all',store:['Line','Column'],value:'Column'},
{xtype: 'label',text: 'Min Value:',x: 10,y: 55},
{id:'lmin',xtype: 'textfield',x: 70,y: 50,width: 120},
{xtype: 'label',text: 'Max Value:',x: 10,y: 95},
{id:'lmax',xtype: 'textfield',x: 70,y: 90,width: 120}
]
});
var Rform = new Ext.form.FormPanel({
id:'Rtab',
layout:'absolute',
height: 201,
items:[
{xtype: 'label',text: 'Style:',x: 10,y: 12},
{id:'rstyle',xtype: 'combo',x: 70,y: 5,width: 120, triggerAction: 'all',store:["Line","Column","None"],value:"Line"},
{xtype: 'label',text: 'Min Value:',x: 10,y: 55},
{id:'rmin',xtype: 'textfield',x: 70,y: 50,width: 120},
{xtype: 'label',text: 'Max Value:',x: 10,y: 95},
{id:'rmax',xtype: 'textfield',x: 70,y: 90,width: 120}
]
});
var tabs = new Ext.TabPanel({
width:450,
activeTab: 0,
frame:true,
defaults:{autoHeight: true},
items: [
{xtype: 'panel',title:'Left Y Axis',items:Lform},
{xtype: 'panel',title:'Right Y Axis',items:Rform}
]
});

new Ext.Panel({
layout:'absolute',
applyTo :'charttoolbar',
height:35,
items:[
{
x:5,
y:5,
width:60,
xtype: 'button',
text: 'Settings',
id:'setting',
handler:function(){//??????
if(!win){
win = new Ext.Window({
layout:'fit',
width:500,
height:300,
items:tabs,
title:'Graphic Setting',
closeAction:'hide',
plain: true,
buttons: [{
text: 'Close',
handler: function(){
var lstyle = Ext.getCmp('lstyle').getValue();
var rstyle = Ext.getCmp('rstyle').getValue();
var lmin = Ext.getCmp('lmin').getValue();
var rmin = Ext.getCmp('rmin').getValue();
var lmax = Ext.getCmp('lmax').getValue();
var rmax = Ext.getCmp('rmax').getValue();
Ext.Ajax.request({
method:'POST',
url: ctx+'/action?obj=analysis.ChartAjaxAction&method=ajax',
params: { xml:chartFileLocale,fuc:'st',type:"str",lstyle:lstyle,rstyle:rstyle,lmin:lmin,rmin:rmin,lmax:lmax,rmax:rmax},
success: function(response,options){
var responseArray = Ext.util.JSON.decode(response.responseText);
callback(responseArray);
},
failure:function(){
alert("Settings Change Failed,Please try again");
}
});
win.hide();
}
}]
});
}
win.show(this);
}
//????????
},
{
y:5,
x:85,
width:60,
xtype: 'button',
text: 'Export',
id:'export',
handler:function(){
FC_startExport();
var etype = $("#exportType").val();
$("#etype").val(etype);
}
},
{
y:5,
x:155,
width:60,
xtype: 'combo',
id:'exportType',
editable : false,
store:['PDF','XLS','DOC'],
triggerAction: 'all',
value:"PDF"
},
{
y:5,
x:225,
width:60,
xtype: 'button',
text: 'Legend Setting',
id:'legendSetting',
handler:function(){
Ext.Ajax.request({
method:'POST',
url: ctx+'/action?obj=analysis.ChartAjaxAction&method=ajax',
params: {xml:chartFileLocale,type:"xml",fuc:'lgnd'},
success: function(response,options){
var responseArray = Ext.util.JSON.decode(response.responseText);
var tempHtml = buildLegend(responseArray[0].xmlData);
if(!lgwin){
lgwin = new Ext.Window({
title:'Legend Setting',
layout:'fit',
collapsible : true,
draggable : true,
id:'lgnd',
width:500,
closeAction:'hide',
plain: true,
html:tempHtml,
buttons: [{
text: 'Close',
handler: function(){
lgwin.hide();
}
}]

});
}
lgwin.show(this);

},
failure: function(){
alert("ajax timeout,please try again!");
}


});
}
}
]

});



});




25217

fay
18 Mar 2011, 12:32 AM
Try using win.show() and lgwin.show() without passing 'this' as a param to them.

leon.wood
18 Mar 2011, 7:19 PM
oh,my mistake,thank you very much~