0

How to hide the columns in Cell table? I need column for grouping purpose but don't want to show in table. Is there any way to hide? Any clue? See the below Code..

TextColumn<ContactInfor> ageTxt = new TextColumn<ContactInfor>() {
    @Override
    public String getValue(ContactInfor object) {
        return object.age;
    }
};
cellTable.addColumn(ageTxt, "AGE");

TextColumn<ContactInfor> empIdTxt = new TextColumn<ContactInfor>() {
    @Override
    public String getValue(ContactInfor object) {
        return object.empId;
    }
};
cellTable.addColumn(empIdTxt, "EMPLOYEE ID");

TextColumn<ContactInfor> addressTxt = new TextColumn<ContactInfor>() {
    @Override
    public String getValue(ContactInfor object) {
        return object.address;
    }
};
cellTable.addColumn(addressTxt, "ADDRESS");

Want to hide addressTxt column from cell table?

Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
moh
  • 1,426
  • 2
  • 16
  • 43
  • possible duplicate of [How to hide column in Cell table GWT?](http://stackoverflow.com/questions/7116758/how-to-hide-column-in-cell-table-gwt) – EMM Mar 25 '15 at 03:15
  • yup..I tried that solution but i did get still the column is visible – moh Mar 25 '15 at 07:26

1 Answers1

0

Assuming you can't actually remove it from the table, perhaps just set the width to 0:

cellTable.setColumnWidth(addressTxt, "0px");

Javadocs: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/cellview/client/CellTable.html#setColumnWidth(com.google.gwt.user.cellview.client.Column,java.lang.String)

slugmandrew
  • 1,776
  • 2
  • 25
  • 45
  • I tried with the above approach like setting column width to "0px" still its not hiding, – moh Mar 24 '15 at 18:07
  • I believe you have to set the whole table to a set width, or setting individual columns will not work: _The layout behavior depends on whether or not the table is using fixed layout._ – slugmandrew Mar 27 '15 at 12:28
  • I cant fixed the width for whole table, i am applying bootstrap to celltable to get responsiveness .. – moh Mar 28 '15 at 01:50
  • You should probably just keep that data outside the table then, and use it to order the data before you populate the table. – slugmandrew Mar 30 '15 at 10:59