Search code examples
gxt

Remove spaces/lines between rows in GXT Grid


My problem

My goal is to create a solid line between certain columns of a Grid. To accomplish this, I've done the following to the appropriate column:

ColumnConfig colConfig = new ColumnConfig("myID", "My Col Title", 50);
colConfig.setStyle("border-right:solid medium black;");

As you can see from the attached picture, the rows seem to have spaces between them that is preventing my column border from being a solid line going down. Can anyone help with either eliminating these lines between rows, or some alternative to accomplish my goal?

I see there is a method provided on the Grid type itself to turn on/off column lines:

grid.setColumnLines(false);

But I don't see anything for rows. I also don't know whether even for columns that method is hiding the lines or actually removing them - I suspect the former.

Thanks in advance for any and all answers.


Solution

  • Hi I did this by using a little string manipulation heres how;

    Create yourself a GridView (extending Grid View) and override the following

    protected String doRender(List<ColumnData> cs, List<ModelData> rows, int startRow, int colCount, boolean stripe) {
            String grab = super.doRender(cs, rows, startRow, colCount, stripe);
            grab = grab.replace("style=\"", "style=\"border:0px none; ");
             return grab;
    

    }

        protected String renderRows(int startRow, int endRow) {
            String grab = super.renderRows(startRow, endRow);
            grab = grab.replace("style=\"", "style=\"border:0px none; ");
            return grab;
        }
    

    this will strip out any borders in grid as its rendered

    hope it helps