Super Tables - HTML Tables with Fixed Headers and More
Posted on February 08, 2008 06:34:50 PM --- 13926 Views
What are Super Tables?
Something that's not really that super yet but may be someday. Super Tables are large HTML tables enhanced with cross-browser fixed vertical and horizontal scrolling headers with custom skins and features.
How do they work?
Using a small (10kb uncompressed) javascript file and an equally small (4kb) CSS skin file, a rendered HTML table is taken by the superTables.js script and is turned into a Super Table using only a single line of javascript code.
Why would I need them?
You might need them if you have one or more large tables on your website and/or application and wish to:
Enhance the user experience.
Constrain tables sizes while still keeping the headers in view.
Turn static tables into web-based spreadsheets.
Avoid having to rewrite old HTML table code into javascript or XML for use in similiar products.
Account
First Name
Last Name
Age
State
Email Address
Favorite Color
Favorite Season
account0001
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0002
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0003
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0004
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0005
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0006
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0007
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0008
Bat
Man
New York
batman@gotham.net
Black
account0009
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0010
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0011
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0012
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0013
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0014
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0015
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0016
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0017
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0018
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0019
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0020
Bat
Man
New York
batman@gotham.net
Black
account0021
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0022
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0023
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0024
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0025
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0026
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0027
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0028
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0029
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0030
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0031
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0032
Bat
Man
New York
batman@gotham.net
Black
account0033
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0034
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0035
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0036
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0037
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0038
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0039
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0040
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0041
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0042
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0043
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0044
Bat
Man
New York
batman@gotham.net
Black
account0045
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0046
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0047
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0048
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0049
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0050
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0051
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0052
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0053
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0054
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0055
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0056
Bat
Man
New York
batman@gotham.net
Black
account0057
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0058
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0059
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0060
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0061
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0062
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0063
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0064
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0065
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0066
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0067
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0068
Bat
Man
New York
batman@gotham.net
Black
account0069
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0070
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0071
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0072
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0073
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0074
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0075
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0076
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0077
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0078
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0079
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0080
Bat
Man
New York
batman@gotham.net
Black
account0081
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0082
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0083
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0084
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0085
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0086
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0087
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0088
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0089
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0090
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0091
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0092
Bat
Man
New York
batman@gotham.net
Black
account0093
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0094
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0095
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0096
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0097
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0098
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0099
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0100
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0101
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0102
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0103
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0104
Bat
Man
New York
batman@gotham.net
Black
account0105
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0106
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0107
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0108
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
account0109
Jim
Bo
25
Delaware
Jim.Bo@gmail.com
Blue
Winter
account0110
Alley
Bo
28
Delaware
Alley.Bo@gmail.com
Red
Summer
account0111
Pablo
Picasso
65
N/A
pablo.picasso@universe.com
All
Spring
account0112
Jen
Dotsen
36
Maryland
jdotsen@yahoo.com
Pink
Winter
account0113
Bill
Tucker
12
Wyoming
superman@gmail.com
Green
Fall
account0114
Mary
Swanson
35
Colorado
mary.swanson@samsonite.com
Green
Spring
account0115
Chris
Tucker
38
California
ctucker@rushhour.com
Gold
Summer
account0116
Bat
Man
New York
batman@gotham.net
Black
account0117
Jimmy
Johnson
31
Nascar
jj@nascar.us
White
Summer
account0118
Britney
Spears
11
Tennessee
bspears@asylum.com
Red
Spring
account0119
M
Jordan
23
Illinois
mjordan@dabulls.com
Red
Winter
account0120
50
Cent
34
Alabama
fiddy@bama.com
Platinum
Fall
Features:
Fixed headers - vertical and horizontal scrolling supported
Supports: Internet Explorer 5.5, 6 & 7, Firefox 2 & 3, Opera 9.25 & 9.5 and Safari 3 (Tested in Windows only)
Rendering speed increased significantly in Firefox and Internet Explorer.
Required CSS styles have lessened dramatically.
rowSpan and colSpan support added.
onStart option added. onStart is a function run before the superTable script begins to re-render the table. Any this.variableNameHere variables you create here can be used later ( eg. onFinish function )
Decreased every CSS skin file from 6kb to 4kb uncompressed.
onFinish option added. onFinish is a function run after the superTable script has re-rendered the table.
All this.variableNameHere variables from the script are accessible in this function. ( eg. this.columnWidths )
Include superTables.js and superTables.css in the page / template containing your HTML table.
Make sure your table has an id assigned to it. Then, in either your onLoad or onDomReady function, create the new superTable object using the table's id as the parameter along with any options you choose.
TO CALL:
new superTable([string] tableId, { options });
OPTIONS:( order does not matter )
cssSkin : string ( eg. "sDefault", "sSky", "sOrange", "sDark" )
headerRows : integer ( default is 1 )
fixedCols : integer ( default is 0 )
colWidths : integer array ( use -1 for auto sizing (in the array) )
onStart : function ( any this.variableNameHere variables you create here can be used later ( eg. onFinish function ) )
onFinish : function ( all this.variableNameHere variables created in this script can be used in this function )EXAMPLES:
var myST = new superTable("myTableId");
var myST = new superTable("myTableId", {
cssSkin : "sDefault",
headerRows : 1,
fixedCols : 2,
colWidths : [100, 230, 220, -1, 120, -1, -1, 120],
onStart : function () {
this.start = new Date();
},
onFinish : function () {
alert("Finished... " + ((new Date()) - this.start) + "ms.");
}
});
Notes / Known Issues (v0.30):
No quirksmode support (officially, but still should work)
Element id's may be duplicated when fixedCols > 0, causing getElementById() issues
Safari will render the header row incorrectly if the fixed header row count is 1 and there is a colspan > 1 in one or more of the cells (fix available)
Regarding Assistance:
My email address is linked to at the bottom of this page on the right hand side. I will also look at any comments on the most recent release announcement post.
Please note: At this time, given how early in release it is, assistance will be very limited.