views:

37

answers:

3

Hello All,

Here is mytable and need the headers to remain while there is a scrollbar only to the results and provide the sorting facility in the name.

<table>
    <tr>
        <td>id</td>
        <td>name</td>
        <td>type</td>
    </tr>
<%
    while(resultSet.next())
    {
        %>
        <tr>
        <td><%=resultSet.getString(1)%></td>
        <td><%=resultSet.getString(2)%></td>
        <td><%=resultSet.getString(3)%></td>
    </tr>
<%
    }
%>
</table>

for the scrollbar, i tried to use div but, it showed blank space.

How can I do these two things?

A: 

Try:

<table height="500" style="overflow-y:scroll;">
Sarfraz
it did not work
maas
Try this style: `style="overflow:auto; overflow-y:scroll;"`
Sarfraz
A: 

Put the header in a <thead> and the rest in a <tbody> and apply the scrollbar to the tbody only.

Dan Stocker
A: 

There are lots of script that already do this on the web :

There are certainly a lot more, that may work very well.

Fabien Ménager