简体   繁体   English

CellTable-如何做rowspan和colspan

[英]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. 我有一个CellTable,我想做一个rowpan和colspan,但是CellTable没有为此提供方法。

In my ui.xml I have my CellTable. 在我的ui.xml中,有我的CellTable。

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

Java Code Celltable: Java代码单元表:

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. 这个CellTable是一个公正的测试。 Its show a header with only one row, but I would like some similar this: http://www.w3.org/TR/html401/images/mergedcells.gif 它显示的标题只有一行,但我想要类似的内容: http : //www.w3.org/TR/html401/images/mergedcells.gif

How can I do this? 我怎样才能做到这一点? Thanks for attention. 感谢您的关注。

You need to create a custom DataGrid. 您需要创建一个自定义DataGrid。 Here is the example and the source code: 这是示例和源代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM