:: Forum >>

Bug with objects sharing the same ID and using onControlClicked() function

Declaring similar objects and having them use the same CSS ID but different onControlClicked() functions results in the last defined function overwriting the previous definitions. I.e. -
var obj1 = new AW.UI.ImageText
var obj2 = new AW.UI.ImageText

obj1.setId("imga")
obj1.setControlImage("close")
obj1.onControlClicked = function(event)
{
alert("Mouse Click obj1")
}
obj2.setId("imga")
obj2.setControlImage("close")
obj2.onControlClicked = function(event)
{
alert("Mouse Click obj2")
}

This can be worked around by not setting an ID but defining a class instead -
...
obj1.setClass("obj", "imga")
obj2.setClass("obj", "imga")
...

This was with version 2.5.3. Not sure about previous versions.
Anthony
Sunday, December 21, 2008
http://www.activewidgets.com/javascript.forum.13245.1/2-grids-problem.html
Sunday, December 21, 2008
This is not a bug but a design requirement. Each AW object MUST have unique id. If you don't specify your own id the library generates one automatically.
Alex (ActiveWidgets)
Tuesday, January 6, 2009

This topic is archived.


Back to support forum

Forum search