views:

4634

answers:

1

Is there any good and light jQuery plugin out there make Scrollable Tables.

I got one at http://www.webtoolkit.info/scrollable-html-table-plugin-for-jquery.html but that won't working non-IE and non-FF browsers.

Thanks!

+6  A: 

If you're looking for light code, skip the jQuery altogether and use pure HTML/CSS:

<table>
    <thead>
        <tr><th>Header Item 1</th><th>Header Item 2</th></tr>
    </thead>
    <tfoot>
        <tr><th>Footer Item 1</th><th>Footer Item 2</th></tr>
    </tfoot>
    <tbody style="overflow-y: scroll; overflow-x: hidden; height: 100px;">
        <tr><td>Item 1-1</td><td>Item 2-1</td></tr>
        ...
        <tr><td>Item 1-N</td><td>Item 2-N</td></tr>
    </tbody>
</table>

The key is in setting the overflow CSS in tbody, so as to make that part scrollable (but not the entire table). You'll also need to set the height, so you can define how tall the scrollable section should be.

Daniel Lew
oh! cool that will do the trick.thanks
Saneef
Keep in mind that this does not a "cross browser" compatible solution. This will not work in Internet Explorer 7 or below or Safari.
James
Ugh, seriously? Yet another reason to add to the list of reasons I despise IE. Won't someone think of the standards: http://www.w3.org/TR/html401/struct/tables.html#h-11.2.3
Daniel Lew
heh, found this via google
Allen