On Monday, February 20, 2012 10:08:26 AM UTC-5, Edward Shave wrote: > > Many thanks for supplying the right answer, unfortunately I realise now I > posed the wrong question. > > Your right answer was new to me and I can certainly make good use of it. > > The question should have been... *Is there a better way to right justify > numeric fields (more specifically, decimal) in a SQLTABLE?* > * > * > I don't want to have to change the css if I change to number or order of > columns... >
In that case, your current method might be the simplest approach. An alternative might be to use the server-side DOM (http://web2py.com/books/default/chapter/29/5#Server-side-DOM-and-parsing) to loop through the SQLTABLE and add a special class to each TD for any column containing numeric fields (and then set the CSS for that class). SQLTABLE also takes a "headers" argument, which is a dictionary of dictionaries and can be used to apply classes to specific columns, but it isn't very flexible or well documented -- you can check the source code (it's in sqlhtml.py) and play around with it. Anthony