Thank you very much, it works wonders.

Here is the code i was trying, when the widget is created it also adds 
static file requirements (css, js) dynamically at the html head by using 
response.include_files() there.
 

> db = DAL('mysql://root:1234@localhost/mydb')
>
> class Widget():
>     def add(self, file):
>         if not file in response.files:
>             response.files.append(file)
>
> class ColorWidget(Widget):
>     #add required files
>     def __init__(self, parameters=None):
>         self.add("js/jquery.js")
>         self.add("js/colorselector.js")
>         self.add("css/colorpicker.css")
>     
>     #return some kind of html markup for the widget
>     def __call__(self, field, value):
>         self.field = field
>         self.value = value
>         return DIV(field.name) 
>
>
> db.define_table('agencies',
>     Field('agency','string', unique=True),
>     Field('color','string', widget=ColorWidget())
> )
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to