Removing caption of CheckboxRenderer

Hey,

we’re using a grid to manage the users from our application. So to assign a user to a certain role we use CheckboxRenderer within the grid’s editor mode. So I wanted to know if there’s a way to remove the column’s caption that is automatically added next to the Checkbox?

Thanks in advance,
Al

Hi,

I had the same need. The behavior is hard-coded into the client side code, unfortunately. I came up with a CSS hack that works but is pretty ugly:

Create a CSS rule:
.checkbox-label-style label {
font-size: 0in;
}

then add a cell style generator on the column of interest, “Inherited” in my case.

    grid.setCellStyleGenerator(new Grid.CellStyleGenerator() {
        private static final long serialVersionUID = 1L;
      @Override
        public String getStyle(CellReference cellReference) {
            CellReference cr = cellReference;
            if (cr.getPropertyId().equals("Inherited"))
                return "checkbox-label-style";
            else
                return null;
        }
    });

It works for Chrome, but other browsers might handle a 0 sized font differently.

As I said, ugly. (I did try altering visibility, but that would also hide the checkbox.)

Bill