PDA

View Full Version : [FIXED-665] setIconClass Bug on IE



jcarbou
26 Feb 2010, 9:04 AM
The setIconClass method (Ext.Panel) does'nt worked correcltly on IE and Ext 2.X or 3.X if :
- iconCls is not setted in config object
- tools is setted on config object

On setIconClass invocation the tile grow up (see screen shot)!!

This code generate the problem (click on any tools to generate the bug):


Ext.onReady(function(){

var panel = new Ext.Panel({
plain:true,
//iconCls:'x-title-lock',
title:'"setIcon with tools" Test',
width:400,
height:200,
tools:[{
id:'gear',
handler:function(){
panel.setIconClass('x-title-edit');
}
},{
id:'search',
handler:function(){
panel.setIconClass('x-title-edit');
}
}]
});

panel.render('test');


});


My css are :


.x-title-lock { background: url(../images/lock.png) 0 0 no-repeat !important;}
.x-title-edit { background: url(../images/Tools/edit.png) 0 0 no-repeat !important;}


I fix the problem with this patch :



Ext.override(Ext.Panel, {
setIconClass : function(cls){
var old = this.iconCls;
this.iconCls = cls;
if(this.rendered && this.header){
if(this.frame){
this.header.addClass('x-panel-icon');
this.header.replaceClass(old, this.iconCls);
}else{
var hd = this.header.dom;
if(this.iconImg){
Ext.fly(this.iconImg).replaceClass(old, this.iconCls);
}else{
this.iconImg = Ext.DomHelper.insertBefore(hd.firstChild, {
tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
});
}
}
}
}
});

Jamie Avins
26 Feb 2010, 5:25 PM
Fixed in SVN 6180. We need to insert the new img before the header span not before the first child.