javagwtgwt-bootstrap

CellTable - How can I do rowspan and colspan


I have a CellTable and I wanna do a rowspan and colspan, but CellTable don't give methods for this.

In my ui.xml I have my CellTable.

<b:CellTable ui:field="groupViewTable></b:CellTable>

Java Code Celltable:

public CellTable<String> createGroupViewTable() {
    groupViewTable = new CellTable<String>();

    groupViewTable.setLoadingIndicator(null);

    List<String> listObjects = new ArrayList<String>();
    listObjects.add("Revenue");
    listObjects.add("Teste");

    TextColumn conceptColumn = new TextColumn() {
        @Override
        public String getValue(Object object) {

            return "Concept";
        }
    };
    groupViewTable.addColumn(conceptColumn, "Concept");

    TextColumn proposalColumn = new TextColumn() {
        @Override
        public String getValue(Object object) {
            return "Proposal";
        }
    };
    groupViewTable.addColumn(conceptColumn, "Proposal");

    TextColumn eurColumn = new TextColumn() {
        @Override
        public String getValue(Object object) {
            return "EUR";
        }
    };
    groupViewTable.addColumn(conceptColumn, "EUR");

    TextColumn hoursColumn = new TextColumn() {
        @Override
        public String getValue(Object object) {
            return "Hours";
        }
    };
    groupViewTable.addColumn(conceptColumn, "Hours");

    TextColumn lastEurColumn = new TextColumn() {
        @Override
        public String getValue(Object object) {
            return "EUR";
        }
    };
    groupViewTable.addColumn(lastEurColumn, "EUR");

    groupViewTable.setRowCount(listObjects.size(), true);
    groupViewTable.setRowData(0, listObjects);

    return groupViewTable;
}

This CellTable is a just test. Its show a header with only one row, but I would like some similar this: http://www.w3.org/TR/html401/images/mergedcells.gif

How can I do this? Thanks for attention.


Solution

  • You need to create a custom DataGrid. Here is the example and the source code:

    http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCustomDataGrid