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

11 Jan 2012, 2:25 AM

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.

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:


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.

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