web2py/web2py — pull request #245 by timrichardson (2013-10-08 23:03:27+00:00)
Title: Issue/1692 part 2: fix virtual fields when fields= is used in SQLFORM.grid

for some reason virtualfields do not get their tablename attribute set which was causing problems with the virtualfields changes to SQLFORM.grid.
The first PR fixed this in cases where no fields argument was passed to the grid.
This PR fixes it when fields is used.

As well, I make sure that virtual fields appear after real fields in the order of columns in the case when the fields argument is not passed to SQLFORM.grid, which looks better; all sortable headings come earlier.