Search code examples
gwtcelltablegwt-celltable

How do I programmatically get info about a CellTable's headers?


I'm using GWT 2.4. I have a com.google.gwt.user.cellview.client.CellTable widget, but I'm having trouble figuring out a programmatic way to get the String headers after the widget is constructed. I add column data like so ...

tableWidget.addColumn(column, header); 

where column is a com.google.gwt.user.cellview.client.Column object and header is a String. how can I get the header from either the column or cell table objects?


Solution

  • For using protected method you can create a custom class, like this:

    public class CustomCellTable extends CellTable {
    
        /* some code... */
    
        /* Method for access to header */
        public TableSectionElement getHeadElement() {
              return this.getTableHeadElement();
        }
    
        /* some code... */
    
    }