DataGrid with a Frozen Column?

683 views
Skip to first unread message

Joshua Godi

unread,
Dec 5, 2012, 10:29:12 AM12/5/12
to google-we...@googlegroups.com
Is it possible to have a frozen column inside a DataGrid? I would like the first column to always show no matter if the user scrolls right or not.

Thanks

Alex opn

unread,
Dec 6, 2012, 10:29:54 AM12/6/12
to google-we...@googlegroups.com
I haven't tried the TableBuilder yet but if it's possible it's by using it imo. Have you had a look into the CustomDataGrid-Example? As I'm currently working a lot with DataGrids I can maybe tell you in some time : ) Right now I have only used Header- and FooterBuilder which can be fun, once you get how they work :-P

tim hemmer

unread,
Aug 29, 2013, 3:54:42 PM8/29/13
to google-we...@googlegroups.com
Any findings on the frozen column(s) for the Data Grid ?

Loo Bin Hooi

unread,
Sep 2, 2016, 4:09:39 AM9/2/16
to GWT Users
I'm also curious about the findings about Frozen Column(s) for GWT datagrid.
Any findings you can share?

Thanks

Rogelio Flores

unread,
Sep 2, 2016, 12:44:47 PM9/2/16
to GWT Users
A colleague of mine implemented "frozen columns" by having two DataGrids. It was for a project at a previous job and can't share the code, but the implementation goes like this:

Create two DataGrids. One will have the frozen column(s).
Put them next to each other horizontally. The one on the left-hand side becomes frozen by having a fixed width (and therefore no horizontal scrollbar).
They share the same DataProvider (they just display a different set of columns of the same data) and Pager. Well, I don't remember if you can use the same Pager or have to synchronize between the two.
The tricky part is to synchronize scrolling through rows of data, but that only applies if you have more rows that can fit on the screen so that you have a vertical scrollbar. You can avoid this work if you have a set height and you only visualize more rows through paging.


(Shameless plug:) see these slides from my GWT.create 2013 presentation for other Cell-based Widget customizations:

BRF

unread,
Sep 3, 2016, 9:26:43 PM9/3/16
to GWT Users
There are other problems you can run into with the two datagrids approach. If the fixed column cells end up with a different height than the second table can end up shorter. The way around that is to have the fixed column in the second table as well, with the same width, but hidden.

I have also implemented a similar approach with GXT and ran into other issues with resizable columns due to a slightly faulty logic in the GXT default column resize handlers.

Sorting can also pose some slight issues in such a setup.

Reply all
Reply to author
Forward
0 new messages