xTable Demo 1

Summary

xTable is an unobtrusive table enhancement. It freezes the table's first row (or THEAD) and first column while the rest of the table is scrollable. If the table has a CAPTION it is removed and inserted above the frozen header.

Disable Javascript and refresh the page to see what the tables look like without the enhancement.

Related Demos:

xTable Demo 2 - Fills the window width and height. See the related forum thread.

xTableHeaderFixed - Supports colspan'd cells in the thead.

4 Nov 10

No code changes but added demo 2 and added some documentation to the xtable.xml file.

24 Jul 09

This demo has been in several discussions (cool!), but it seems my notes below may have misled people to think their html table must contain nested tables - it doesn't. The nested elements are all created dynamically. In the html all you need is a regular table.

16 Mar 07

When I first wrote xTable I had ideas for making it support the locking of any number of rows and cols - but I didn't have time to go that far with it. I would like to rewrite that object - some day perhaps.

Use a DOM Inspector to see how the dynamically created elements are structured. The table is removed and in its place is inserted a DIV (class xtRoot) which contains three DIVs. They are absolutely positioned within the relatively positioned xtRoot. Those three are the frozen row container, the frozen col container and the table container.

The frozen row and col containers have "inner containers" in order to implement simulated scrolling. An inner container has a DIV for each cell found in the original row or col (which eventually gets removed). In each of these "cell DIVs" is a one-celled table. I didn't, and still don't, like inserting a table for every cell in the frozen row or col - but it was a compromise - I was running out of time to put into it. Getting a frozen cell's contents to retain its original styling meant it had to be in a table cell. Getting the frozen cells to align and scroll in sync with the table proved to be quite tricky ;-) especially getting it to work cross-browser - so that also resulted in some compromises.

30 Jan 07

Code update.

Demo 1

Table 1 Caption
T1T1Col1T1Col2T1Col3T1Col4T1Col5T1Col6T1Col7T1Col8T1Col9T1ColAT1ColBT1ColCT1ColDT1ColET1ColF
T1Body0r0c1r0c2r0c3r0c4Row 0, Col 5r0c6r0c7r0c8r0c9r0cAr0cBr0cCr0cDr0cEr0cF
T1Row1r1c1r1c2r1c3r1c4r1c5r1c6r1c7r1c8r1c9r1cAr1cBr1cCr1cDr1cEr1cF
T1Row2r2c1r2c2r2c3r2c4r2c5r2c6r2c7r2c8r2c9r2cAr2cBr2cCr2cDr2cEr2cF
T1Row3r3c1r3c2r3c3r3c4r3c5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1r13c2r13c3r13c5r13c6r13c7r13c8r13c9r13cAr3cBr13cCr13cDr13cEr13cF
T1Row14r14c1r14c2r14c3r14c4r14c5r14c6r14c7r14c8r14c9r14cAr4cBr14cCr14cDr14cEr14cF
T1Row15r15c1r15c2r15c3r15c4r15c5r15c6r15c7r15c8r15c9r15cAr5cBr15cCr15cDr15cEr15cF
T1Row16r16c1r16c2r16c3r16c4r16c5r16c6r16c7r16c8r16c9r16cAr6cBr16cCr16cDr16cEr16cF
T1Row17r17c1r17c2r17c3r17c4r17c5r17c6r17c7r17c8r17c9r17cAr7cBr17cCr17cDr17cEr17cF
T1Row18r18c1r18c2r18c3r18c4r18c5r18c6r18c7r18c8r18c9r18cAr8cBr18cCr18cDr18cEr18cF
T1Row19r19c1r19c2r19c3r19c4r19c5r19c6r19c7r19c8r19c9cross-browser.com ... javascript toys!r9cBr19cCr19cDr19cEr19cF
T1Row1Ar1Ac1r1Ac2r1Ac3r1Ac4r1Ac5r1Ac6r1Ac7r1Ac8r1Ac9r1AcArAcBr1AcCr1AcDr1AcEr1AcF
T1Row1Br1Bc1r1Bc2r1Bc3r1Bc4r1Bc5r1Bc6r1Bc7r1Bc8r1Bc9r1BcArBcBr1BcCr1BcDr1BcEr1BcF
T1Row1Cr1Cc1r1Cc2r1Cc3r1Cc4r1Cc5r1Cc6r1Cc7r1Cc8r1Cc9r1CcArCcBr1CcCr1CcDr1CcEr1CcF
T1Row1DIf you like xTable you might also like xTableHeaderFixedr1Dc2r1Dc3r1Dc4r1Dc5r1Dc6r1Dc7r1Dc8r1Dc9r1DcArDcBr1DcCr1DcDr1DcEr1DcF
T1Row1Er1Ec1r1Ec2r1Ec3r1Ec4r1Ec5r1Ec6r1Ec7r1Ec8r1Ec9r1EcArEcBr1EcCr1EcDr1EcEr1EcF
T1Row1Fr1Fc1r1Fc2r1Fc3r1Fc4r1Fc5r1Fc6r1Fc7r1Fc8r1Fc9r1FcArFcBr1FcCr1FcDr1FcEr1FcF

Demo 2

This one has no caption.

T2Excepteursintoccaecat cupidatatnon proidentsuntin culpaquiofficiadeseruntmollitanimid estlaborumMike'sX Library
T2Row0
Lorem ipsum dolor sit amet
r0c2r0c3r0c4r0c5r0c6r0c7r0c8r0c9r0cAr0cBr0cCr0cDr0cEr0cF
Excepteurr1c1r1c2r1c3r1c4r1c5r1c6r1c7r1c8r1c9r1cAr1cBr1cCr1cDr1cEr1cF
X
Lib
r2c1r2c2r2c3r2c4r2c5r2c6r2c7r2c8r2c9r2cAr2cBr2cCr2cDr2cEr2cF
occaecatr3c1r3c2r3c3r3c4r3c5r3c6r3c7r3c8r3c9r3cAr3cBr3cCr3cDr3cEr3cF
T2Row4r4c1r4c2r4c3r4c4r4c5r4c6r4c7r4c8r4c9r4cAr4cBr4cCr4cDr4cEr4cF
T2Row5r5c1r5c2r5c3r5c4r5c5r5c6r5c7r5c9r5cAr5cBr5cCr5cDr5cEr5cF
T2Row6r6c1r6c2consectetaur adipisicing elit, sed do eiusmod temporr6c4r6c5r6c6r6c7r6c8r6c9r6cAr6cBr6cCr6cDr6cEr6cF
cupidatatr7c1r7c2r7c3r7c4r7c5r7c6r7c7r7c8r7c9r7cAr7cBr7cCr7cDr7cEincididunt ut labore et dolore magna aliqua.
T2Row8r8c1r8c2r8c3r8c4r8c5r8c6r8c7r8c8r8c9r8cAr8cBr8cCr8cDr8cEr8cF
non proidentr9c1r9c2r9c3r9c4r9c5r9c6r9c7r9c8r9c9r9cAr9cBr9cCr9cDr9cEr9cF
T2RowArAc1rAc2rAc3rAc4rAc5rAc6rAc7rAc8rAc9rAcArAcBrAcCrAcDrAcErAcF
sunt in culparBc1rBc2rBc3rBc4rBc5rBc6rBc7rBc8rBc9rBcArBcBrBcCrBcDrBcErBcF
quirCc1rCc2rCc3rCc4rCc5rCc6rCc7rCc8rCc9rCcArCcBrCcCrCcDrCcErCcF
T2RowDrDc1rDc2rDc3rDc4rDc5rDc6rDc7rDc8rDc9rDcArDcBrDcCrDcDrDcErDcF
deseruntrEc1rEc2rEc3rEc4rEc5rEc6rEc7rEc8rEc9rEcArEcBrEcCrEcDrEcErEcF
id est laborumrFc1rFc2rFc3rFc4rFc5rFc6rFc7rFc8rFc9rFcAUt enim adminim veniam,rFcDrFcErFcF
T2Row10r10c1r10c2r10c3r10c4r10c5r10c6r10c7r10c8r10c9r10cAr0cBr10cCr10cDr10cEr10cF
T2Row11r11c1r11c2r11c3r11c4r11c5r11c6r11c7r11c8r11c9r11cAr1cBr11cCr11cDr11cEr11cF
T2Row12r12c1r12c2r12c3r12c4r12c5r12c6r12c7r12c8r12c9r12cAr2cBr12cCr12cDr12cEr12cF
Xr13c1r13c2r13c3r13c4r13c5r13c6r13c7r13c8r13c9r13cAr3cBr13cCr13cDr13cEr13cF
Poweredr14c1r14c2r14c3r14c4r14c5r14c6r14c7r14c8r14c9r14cAr4cBr14cCr14cDr14cEr14cF
Javascriptr15c1r15c2r15c3r15c4r15c5r15c6r15c7r15c8r15c9r15cAr5cBr15cCr15cDr15cEr15cF
Toysr16c1r16c2quis nostrud exercitation ullamco laboris nisi ut aliquipr16c4r16c5r16c6r16c7r16c8r16c9r16cAr6cBr16cCr16cDr16cEr16cF
!!!r17c1r17c2r17c3r17c4r17c5r17c6r17c7r17c8r17c9r17cAr7cBr17cCr17cDr17cEr17cF
xTableex ea commodo consequat.r18c2r18c3r18c4r18c5r18c6r18c7r18c8r18c9r18cAr8cBr18cCr18cDr18cEr18cF
xSplitterr19c1r19c2r19c3r19c4r19c5r19c6r19c7r19c8r19c9r19cAr9cBr19cC
Duis aute irure dolor in reprehenderit
r19cEr19cF
xSelectr1Ac1r1Ac2r1Ac3r1Ac4r1Ac5r1Ac6r1Ac7r1Ac8r1Ac9r1AcArAcBr1AcCr1AcDr1AcEr1AcF
xAnimationr1Bc1r1Bc2r1Bc3r1Bc4r1Bc5r1Bc6in voluptate velit esse cillumr1Bc8r1Bc9r1BcArBcBr1BcCr1BcDr1BcEr1BcF
xTreeMenur1Cc1r1Cc2r1Cc3r1Cc4r1Cc5r1Cc6r1Cc7r1Cc8r1Cc9r1CcArCcBr1CcCr1CcDr1CcEr1CcF
xToolbarr1Dc1r1Dc2r1Dc3r1Dc4r1Dc5r1Dc6r1Dc7r1Dc8r1Dc9r1DcArDcBr1DcCr1DcDdolore eu fugiat nulla pariatur.r1DcF
Table 2, Row 1Er1Ec1r1Ec2r1Ec3r1Ec4r1Ec5r1Ec6r1Ec7r1Ec8r1Ec9r1EcArEcBr1EcCr1EcDr1EcEr1EcF
T2Row1Fr1Fc1r1Fc2r1Fc3r1Fc4r1Fc5r1Fc6r1Fc7r1Fc8r1Fc9r1FcArFcBr1FcCr1FcDr1FcEr1FcF