Freeze table heading?

14 views
Skip to first unread message

NA

unread,
Sep 27, 2011, 10:13:48 AM9/27/11
to Google Visualization API
Is it possible to get the headings in a Table to freeze, so that if
you scroll down they remain visible?

asgallant

unread,
Sep 27, 2011, 10:28:27 AM9/27/11
to google-visua...@googlegroups.com
Is it possible?  Yes.  It may not, however, be easy.  There is no explicit support in the API for this, but there are a few options you can explore, here are two:


The jQuery plugin is probably easier to use, but the first has the advantage of being entirely done in CSS.  I have no idea how well or poorly they would interface with the Table charts, YMMV.

The Table charts do support paging, which would get you a similar effect and is trivially easy to implement.

NA

unread,
Sep 27, 2011, 11:08:07 AM9/27/11
to Google Visualization API
So it looks like the google.visualization.Table class doesn't support
this? I'm reluctant to use another library to try to manipulate the
GVIZ objects. I I were going to use another library, I suspect it's
be easier and possibly more reliable to not use the GVIZ library in
the first place, and just use the other library as it was intended.

Paging is easy to implement but I wouldn't say it's similar. If you
want to freeze a heading, paging really isn't going to satisfy you!

Thanks for the links, though.

best,

asgallant

unread,
Sep 27, 2011, 12:15:30 PM9/27/11
to google-visua...@googlegroups.com
Paging is similar if the goal is to have the header always showing (in my experience, this is usually why one would freeze a header), but that's about where it ends.  The CSS solution doesn't require any additional libraries, and since the Table charts are just heavily styled HTML tables, theoretically you should be able to make it work.  Implementing it will likely be challenging, but that's probably all that stands in your way.

NA

unread,
Sep 27, 2011, 12:45:57 PM9/27/11
to Google Visualization API
I want to show the header, but I specifically don't want paging (I
find paging distracting when scanning data). It is a nice idea, but
given my anti-paging constraint, it won't work!

Re the css: The problem is that the html and css used to create the
GVIZ Tables isn't documented nor is it part of the spec, meaning it
can be changed between releases. This makes the problem more
difficult to manage. It's not a technical issue (I have the ability
to implement it), but more of a planning and product management one (I
don't want to be caught off guard one day to find that my tables don't
work because I'm relying on undocumented characteristics of the
table). That's why I'm reluctant to try it.

I'll put in an enhancement request for this to be built into the
tables. It seems reasonable enough, and would be much more reliable
if it were part of the Table class.

Reply all
Reply to author
Forward
0 new messages