Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A GWT CellTable with frozen header and initial column

Tags:

widget

gwt

I need to freeze the first column and first row of data in a CellTable, so that users can scroll through the data but still see the labels on the "axes." The first column should scroll when the user scrolls up and down, and the header row should scroll when the user scrolls left and right. Think "Freeze Panes" in Excel.

I'm using GWT 2.1 and am willing to write my own widget to do this if no solutions already exist. My question is a two-parter:

  1. Do any widgets already have this behavior?
  2. Any suggestions if I'm going to implement this myself?

Thanks!

like image 881
Riley Lark Avatar asked Nov 01 '10 22:11

Riley Lark


1 Answers

I implemented a solution myself. Check out http://larkolicio.us/ScrollTable/ExperimentTables.html

It's a LayoutPanel with three AbsolutePanels inside it. The frozen columns are a CellTable, the main part is a CellTable, and the header is a Grid - I could find no way to set the width of a CellTable column! A ScrollHandler links the main part to the two frozen parts. There is a little bit of delay - I'd appreciate it if someone could find a way to get rid of the lag between the sections.

I got it working to a point that I could use it, and stopped. It is not a general-purpose widget. Please feel free to use it at your own risk.

like image 127
Riley Lark Avatar answered Oct 04 '22 14:10

Riley Lark