grid uses represent if available. 
http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation

On Thursday, June 6, 2013 2:46:47 PM UTC+2, keep...@gmail.com wrote:
>
> Hello everyone.
>
> I'm new to web2py and I have a question about customizing fields in 
> SQLform.grid. Probably the most frequently asked question for you :)
>
> Let me describe what I want to do:
>
> There is a table consisting of the following columns:
>
> id | min_time | max_time | execute_time | level_warn | lastdate
>
> These values ??- runtime SQL-script from database Firebird:
>
> min_time - the minimum execution time
> max_time - maximum execution time
> execute_time - the actual execution time
>
> If execute_time <= min_time, then level_warn = 1
> If execute_time> min_time <max_time, then level_warn = 2
> If execute_time> max_time, then level_warn = 3
>
> Finally, a question:
>
> How to make depending on the value of level_warn, table cell that contains 
> the value, color codes?
> For example,
>
> level_warn = 1, color - green.
> level_warn = 2, color - yellow.
> level_warn = 3, color - red.
>
> My controller is as follows:
>
> def temp ():
>
>     response.view = 'temp.html'
>     db.TEMPER_RC.id.readable = False
>     sort_order = [db.TEMPER_RC.id]
>     headers = {'TEMPER_RC.name': 'RC'
>                'TEMPER_RC.min_time': 'Min. time, min. '
>                'TEMPER_RC.max_time': 'Max. time, min. '
>                'TEMPER_RC.execute_time': 'Act. time, min. '
>                'TEMPER_RC.level_warn': 'alarm level'
>                'TEMPER_RC.lastdate': 'Time Check'}
>     grid = SQLFORM.grid (db.TEMPER_RC,
>                       user_signature = True, deletable = False, headers = 
> headers,
>                       editable = False, create = False, paginate = 30, csv 
> = False,
>                       maxtextlength = 31, orderby = sort_order, ui = 
> 'web2py')
>     return locals ()
>
>     
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to