Fix sizing issues with datagrid headers and bodies.
Review Request #10743 — Created Oct. 4, 2019 and submitted
Datagrids had some off-by-0.5px issues that created tiny gaps to the
right of datagrid headers and bodies, leaving a little visual noise on
high-DPI displays. We had attempted to work around this in the past, but
it relied on older behavior in jQuery that rounded pixels, which wasn't
safe and regressed when we upgraded jQuery a while back. We now round
this ourselves, ensuring we're using a suitable size.
We also had a much larger gap on the right-hand side of the header when
the body had a scrollbar visible. This was caused by us fetching the
width of the datagrid body using
which meant the scrollbar wasn't being factored in.
Those calculations also fell apart on datagrids without column
customization. We were always updating the second-to-last column to take
the extra width intended for the scrollbar, assuming that that column
was the last data column and that the last actual column was the Edit
Columns icon. We now check whether the datagrid offers column
customization, adjusting the index of the last data column accordingly.
Tested on datagrids with and without scrollbars, and datagrids with
and without column customization.