Hello,

I have a spreadsheet of items and I want to track their inventory based on 
color (similar to an excel spreadsheet).

I have two columns for example: Item, Item_Status
The item could be a desk, chair, etc... and for status I have 1 2 or 3.

If the status is 1 I would like to make the cell color of the desk green, 2 
yellow, 3 red.

so far I have 

def represent_colored(value):
   if value == 1:
   return SPAN(value,_style="background-color:green',)
elif value == 2:
   return SPAN(value,_style="background-color:yellow',)
elif value == 3:
   return SPAN(value,_style="background-color:red',)
else:
   return SPAN(value,_style="background-color:orange',)

def inventory():
   db.inventory.items.represent = lambda value, row: 
represent_colored(value)
   grid=SQLFORM.grid(db.inventory, paginate=20)
   return dict(grid=grid)

This works so far, but it only changes the background color of the text in 
the status column and I want to change the column of the actual item. I 
also would like to change the entire cell <td> instead of just the 
background behind the text.
Also, I plan on branching the inventory out to multiple columns and I have 
two questions:

1) How could I change the entire cell color?
2) Is making multiple "status" columns the most efficient and pythonic way 
to accomplish this.

You guys are the best!


Wil
   

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to