PDA

View Full Version : How to set image alt atribute in object config



Romick
11 Jan 2012, 2:25 AM
Hi!

{
xtype: 'image',
id: 'id_img'
}

I can do it later by the following code:


Ext.getCmp('id_img').el.dom.alt=' No Logo Selected';

but i need to do it in config.

skirtle
11 Jan 2012, 8:19 AM
You've got a number of options but you can't do it just by setting a config option on that class.

You could subclass Ext.Img and override getElConfig.

Alternatively, if you don't need setSrc, you could create an Ext.Component and set the autoEl.

Take a look at the code to Ext.Img, there really isn't much to it:

http://docs.sencha.com/ext-js/4-0/source/Img.html

slemmon
11 Jan 2012, 12:33 PM
Someone must have seen your request coming. Looks like you can set alt as a config in 4.1 B1.

Romick
12 Jan 2012, 1:56 AM
Thank you!!! It's nice set alt as a config in 4.1.