In trunk, SQLFORM.grid and SQLTABLE now include a <colgroup> element that
includes a <col> element for each column in the grid/table. Each col
element includes a "data-column" attribute with the number of the column
within the table (starting at 1). Columns that represent DAL table fields
also have id's like "tablename-fielname". For example:
<table>
<colgroup>
<col id="mytable-field1" data-column="1"></col>
<col id="mytable-field2" data-column="2"></col>
...
</colgroup>
So, to style a particular column, you can now do:
col#mytable-field1 {...}
Note that CSS styles applied to COL elements are overridden by any styles
applied to TR or TD elements, so the above method is somewhat limited.
However, using Javascript and the data-column attribute, you can do
something like:
var mycol = $('col#mytable-myfield').attr('data-column');
$('td:nth-child(' + mycol + ')').css(...);
Anthony
--
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/groups/opt_out.