Fix grid width calculation.

The grid was always being sized to the max width of the last row instead
of the max width of all rows.