Page 1 of 1

Default Event for Custom Widget.

Posted: Thu May 10, 2012 4:06 pm
by Nathan
Hello,

can anyone tell me ( or point to the documentation if i'm missing it) how to create a custom widget with a default click event?

I've tried.
defaults: {
"onclick": "alert('HI!');"
}

in both pui.widgets.add() and pui.toolbox.add() with no luck.

I'm looking to create a quick widget to include on pages. This widget will just be an element (say a div) with an background image that will alert some values when clicked.

Thanks
-Nathan

Re: Default Event for Custom Widget.

Posted: Fri May 11, 2012 9:51 am
by David
I've attached an example of creating an image widget with certain image applied and an onclick event.

To install, remove the ".txt" extension and place here:

/www/profoundui/htdocs/profoundui/userdata/custom/widgets

The widget will appear in the last category Custom Widgets.

See docs here:

http://www.profoundlogic.com/docs/displ ... evelopment

I thought the image widget was an easy way to do what you described, but if you really want a <div> element, just use the output field widget as your base, and then assign a "css class" property to attach a class where you can define the background image.