:: Forum >> Version 2 >>

howto add "onclik" on header image

I can add an image to a header using grid.setHeaderImage("favorite", 0); but how would I add "onclick" event to that image or "hover" etc... ?
Philippe Marzin
Wednesday, January 30, 2008
You can assign html event handlers directly to the image object using setEvent method -

var header = new AW.Grid.Header;
var 
image header.getContent("box/image");
image.setEvent("onclick", function(event){
    
alert(1);
    
event.cancelBubble true;
});

obj.setHeaderTemplate(header0);
obj.setHeaderImage("favorites"0);
 
or use grid onHeaderClicked event and check which element was the event target.
Alex (ActiveWidgets)
Wednesday, January 30, 2008
Thanks - nice and elegant.
Philippe Marzin
Wednesday, January 30, 2008



This topic is archived.

Back to support forum

Forum search