Link Details

Link 16060 thumbnail
User 209701 avatar

By justas
Published: Mar 14 2007 / 18:26

This JavaScript code can be used to convert tables in ordinary HTML into scrollable ones. No additional coding is necessary.
  • 17
  • 0
  • 4115
  • 3


Add your comment
User 209577 avatar

LudoA replied ago:

0 votes Vote down Vote up Reply

Can't this be done by simply putting the table in a fixed-size div and adding the CSS "overflow: scroll;" property?

User 209464 avatar

willcode4beer replied ago:

1 votes Vote down Vote up Reply

the table head and foot would not stay in place that way. this appears to only scroll the tbody part.
One tiny little thing though. He put the tfoot after the tbody instead of before.

User 209577 avatar

LudoA replied ago:

1 votes Vote down Vote up Reply

Hmm, right, didn't think about that.
Still, if I *really* needed scrollable tables with headers, I think I'd just place headers, than a div which contains the table and use CSS.
I mean, seriously, how long is that code? Not to diss the author or anything - it's amazing what he managed! - but that isn't worth it IMHO :)
It makes me wonder, however, whether we don't need a more high-level "toolkit" for the web.
So I can go all "Table names = new Table(); names.setScrollable(Table.BODY);" or something like that.
I really think we should rework how the web's GUI design works. Separation of content & lay-out is great, but this is still way to basic. We need more advanced features too. Some complain that Java Swing is too low-level, but compared to the Web, it's incredibly high-level.
Maybe my Java-ish solution isn't the way to go, though (actually, it most probably isn't, seeing as how I'm totally inexperienced). Maybe "all" we need is a more feature-complete CSS. I'm wondering what the CSS syntax would be for only making the table's items scrollable, but I just can't think of anything clean that would fit into CSS's current syntax. Maybe CSS is just designed for more simple things, and CSS needs to be replaced.
Or maybe that guy's Javascript is the way to go, and it should simply have to be included in one of the JS frameworks (like dojo, etc), so we could use it by calling something like setScrollable().

I've been thinking lately that one big Javascript framework combining the great things of all the current frameworks would be a good thing. Then, that big JS framework would be included in browsers, and we could all use a standard framework when creating a website.
Or maybe we could have multiple frameworks, and we'd just import the ones we want. Can you notice I've been learning Java these days? :-)

Okay, enough philosophical ramblings for today :-) Just thought I'd share some thoughts I've been having for a couple of days now.
I'm a completely novice programmer, so any thoughs / insights about my comment would be really appreciated - I'm curious to hear if I'm totally overseeing something.

User 58280 avatar

rs33272 replied ago:

0 votes Vote down Vote up Reply

Much more coding involved, but more useful is the Rico LiveGrid library that pulls data from the server as the user scrolls the table (an alternative to the traditional paging model)

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java