...

View Full Version : Lock Table Headers



Basscyst
10-05-2003, 11:55 PM
Is there a way to lock an html table header so that it doesn't scroll but the rest of the table does. Similar to excel when you lock a row?

liorean
10-06-2003, 12:23 AM
Have you tried using thead, tfoot and tbody, and set a explicit (preferably absolute) height on the tbody, together with an overflow: auto;?

Basscyst
10-06-2003, 12:25 AM
I was just looking into somthing similar your suggestion will allow me to go a little deeper now. I'll try it. Thanks.

liorean
10-06-2003, 12:35 AM
Well, I'm not sure it'll work. The different table elements can behave weird sometimes, and the css spec is not clear about them at all times. It's just my "best shot" at how to work it out. If it doesn't work you can try it on the table element, putting the header and footer in separate tables before and after. It's not as elegant or correct a solution, but it might have better support.

That's all speculation, though. Test the tbody/thead/tfoot elements first.

Basscyst
10-06-2003, 12:41 AM
Doesn't seem to work. I see that it is easily done by using a seperate table as the header but my table is sortable so I need to do it with a single table.

here is the code for the table sorry it is kind of messy.

function makeTable()
{

window.pane.document.write('<style>.pink{background-color:pink;width:350px;}.blue{background-color:lightblue;width:350px;}.yellow{background-color:yellow} table{text-align:center}</style><head><script language="javascript" src="sortTable1.js">' + ccc + '</head><body onLoad=initTable("table0");><center><br><br>You are viewing entries from the ' + f + ' folder.<table id="table0" border=1><thead style="position:absolute;height:5px;overflow:auto;"><tr><td>Name<td>Rep Frequency</a><td>MDN</a><td>MDN Frequency</a><td>Supervisor</a><td>Pin</a><td>Date</a><td>Time</a></td></tr></thead><tbody>');

for(i=0;i<userlist.length;i++)
{
window.pane.document.writeln('<TR bgcolor="#FFFFFF" style="overflow:auto;"><td class="blue">' + userlist[i] + '</td><td class="pink">' + fullcountuser[i] + '</td><td class="blue">' + mdnlist[i] + '</td><td class="pink">' + fullcountmdn[i] + '</td><td class="blue">' + superlist[i] + '</td><td class="pink">' + pinnerlist[i] + '</td><td class="blue">' + whenlist[i] + '</td><td class="pink">' + timerlist[i] + '</td></tr>');
}

window.pane.document.writeln('</tbody></table></body>');msg.close();administrator(f,g);
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum