I have a table rendered from custom control over which I have no control yet I need to make this table scrollable so that the header, or actually the first row is fixed. Is there a jQuery plugin that would allow me to do this?
views:
16315answers:
8Don't need a jQuery plugin, what you can do is separate the headers from the other rows (create two tables), and then use a overflow:scroll for the css of the regular rows.
Update (in response to note being able to control content):
Use Flexigrid:
$('#flexme').flexigrid();
Consider using CSS:
table th
{
position: fixed;
}
But it might not be what you're looking for. Also consider using overflow:
table tbody
{
overflow: scroll;
}
and just wrap your table body in the <tbody />
container.
On the topic of cool JavaScript table programs - check out a frequency decoder article on sorting tables on the fly - I've worked with this script before and it's fantastic.
I just wrote a jQuery plugin that does exactly what you need. You just build 1 table with a thead and tbody and it does the rest for you. Very simple to use...i posted the solution under another question linked below.
http://stackoverflow.com/questions/486576/frozen-table-header-inside-scrollable-div/1533619#1533619
or a link straight to my plugin site:
Another solution is discussed here without using jQuery or any other libraries
Hey,
I have a really simply solution that I created to this using basic CSS and a little bit of jQuery script. I even have it set so that the user can turn the locking headers on and off at will.
Check it out: http://www.bobthegeek.com/?p=12
Let me know if you have any questions.
Thanks.
Bob
Would love to see a no-frills jquery plugin that allows sortable header and scrolling rows. Of the options above, Flexigrid comes closest, but it's overkill.
Here is a good jquery plugin, working in all browsers !
You have a fixed header table without fixing his width...
Check it : http://www.tablefixedheader.com/