PDA

View Full Version : Ext.Img temporary value or ALT attribute



simkea
12 Feb 2012, 4:47 AM
Hello, i need your help


var imagebutton = [];
for(var i=1;i<=5;i++){
imagebutton[i] = Ext.create('Ext.Img', {
data: i ,src: 'icon'+i+'a.png',
listeners: {
click: {
element: 'el',fn: function(o){ todo(i);}
}
}
});
};//for

how can I save a temporary value in the object?
How do I create an ALT attribute in this component?

thx.

mitchellsimoens
12 Feb 2012, 8:09 AM
You would have to override the getElConfig method to add in the alt attrib

slemmon
12 Feb 2012, 6:14 PM
You might check out 4.1 Beta. Alt is a config in 4.1's Image component.

LesJ
13 Feb 2012, 3:06 AM
You would have to override the getElConfig method to add in the alt attrib

Risky... getElConfig is a private method. It would be better to use the autoEl property. See this thread (http://www.sencha.com/forum/showthread.php?176553-4.1-B1-Ext.draw.Text-broken-when-getElConfig-present).

Check 4.1, the alt attribute is now supported.

Romick
13 Feb 2012, 5:50 AM
But why not simply:

var imagebutton = [];
for(var i=1;i<=5;i++){
imagebutton[i] = Ext.create('Ext.Img', {
data: i ,
src: 'icon'+i+'a.png',
listeners: {
click: {
element: 'el',fn: function(o){ todo(i);}
}
}
});
imagebutton[i].temporaryValue = 'Some Temp value';
};//for

about alt http://www.sencha.com/forum/showthread.php?173512-How-to-set-image-alt-atribute-in-object-config