Oliver Watkins Oliver Watkins - 4 months ago 19
CSS Question

Adding icon to Extjs toolbar

I am trying to add an icon to my toolbar (arbitrary - not associated with a button).

In my CSS I define the URL like this :

.myCoolLookingIcon {
background-image: url('../ext-theme-gray/images/grid/columns.gif');
}


And that works fine if I am setting icons for buttons by using iconCls.

I would like this icon in a label or image

I have tried :

xtype: 'label',
iconCls: 'myCoolLookingIcon '


and

xtype: 'image',
html: '<img class="myCoolLookingIcon "/>'


but that doesn't seem to work in either case.

Answer

This is one of the way of achieving what you want (Not using the iconCls)

xtype:'label',
html: '<img src=\"path_to_icon\">'

Try this:

 xtype:'label',
 html: '<img class="className" width="20" height="20">'

Giving width and height, makes it work.