Thanks for the reply, Niphlod.
Now there was the following question:
I add the following lines to the controller before the grid = SQLFORM.grid
...
warn = db.executesql ('SELECT t.level_warn FROM TEMPER_RC t;')
for val in warn:
if (val == (1)):
db.TEMPER_RC.level_warn.represent = lambda value, row: (B (DIV
(str ('1 '% row if row else''), _style =' background: # 339933 ')))
elif (val == (2)):
db.TEMPER_RC.level_warn.represent = lambda value, row: (B (DIV
(str ('2 '% row if row else''), _style =' background: # FFFF33 ')))
else:
db.TEMPER_RC.level_warn.represent = lambda value, row: (B (DIV
(str ('3 '% row if row else''), _style =' background: # FF0000 ')))
But only fulfills the first condition, and all the fields level_warn
colored in green. Moreover, the condition fulfills wrong, because the first
row in the table has a value of 3, that is, the field must be painted red!
What am I doing wrong?
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.