Reworked row/column label trimming in grid.js.