Freeze Panes html table like excel
There are already a few scripts around that demonstrate how to freeze a HTML table top row and first column.
Most of these scripts are specific to Internet Explorer while a couple I have tried are cross browser compatible using CSS but require the column widths to be set to a specific width...for example all column widths must be set to 100px wide. This I also found not to be ideal because the columns hide any content that is wider than 100px and offered no way of adjusting the column widths to view the hidden data via an onscreen control....not ideal for dynamically created data from a database.
This example is perfect for tables containing large amounts of data and is cross browser compatable(tested IE6,IE7,Fire Fox 2.0.0.6,Opera 9.22)
and might be best employed using database recorset paging.
2nd March 2008:
Best performance for scrolling columns was with using Fire Fox and Opera, while IE was a little slow. Rows were about the same.
The script simply hides/unhides columns or rows using scrolling buttons:
Place the javascript function in either the head or body of your page.
The script could be better optimised, but for demonstration the code is easy enough to follow:
CommentsFreezer: Works great, thankou! Will: Updated to version 1.1 for better layout within a scrollable div using custom horizontal and verticle scrollbars.
excel: hi, great thanx. Andrei: I want to scroll left 3 columns at a time and I've studied your JavaScript code. I'm still confused about it. Can you tell me please what lines should I modify or what lines of code should I add ? Andrei: And also, if I want to start scrolling from second column, what should I modify? var myCol=2; ? Will: Don't know about your first question.
Andrei: I solved it :) Thanks.
J_P: you have a nice piece of code here.
Peter: i have tables in a for loop and how to set the table id ? Suren: Its cool working gud but not working for multiple tables .what should i modify to make it work for multiple talbes?? thanks in advance 10 of 60 comments (part 2) [ « ] [ * ]
|