JavaBlog.fr / Java.lu DEVELOPMENT,GWT,WEB GWT: FlexTable show / hide column

GWT: FlexTable show / hide column

During my self-training on GWT (Google Web Toolkit) and GAE (Google App Engine) which will be the topic of several next posts (presentation GWT and GEA, creation of new application with 2 interfaces JSP and GWT, securised by Spring security and the persistence with JPA/App Engine datastore, deployment on GEA..), I have encountered a deficiency or missing method in the FlexTable component of GWT.
This component has not a method to show/hide columns in Flextables at 1 line.

There is a method to hide a row:

    compFlextable.getRowFormatter().setVisible(arg0, arg1); 

But there is not method to hide a specific column:

    compFlextable.getColumnFormatter().setVisible(arg0, arg1); 

Here, a simple method which allows the hiding and showing of a column in a Flextable by the hiding of the column’s cell on each row:

	private void setColumnVisible(FlexTable table, int Col, boolean b) {
		for (int i = 0; i < table.getRowCount(); i++) {
			table.getCellFormatter().setVisible(i, Col, b);
		}
	}

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post