开发者

Tbody Scrollbar Problem

I have the following code that I want to modify so that the tbody can have a scrollbar without the thead moving:

<table class="sortable">
<thead border="0" cellspacing="0" cellpadding="2" align="left" style="position:relative; bottom:-3px; left:0px;">
<tr>
<%
For i = 0 to Ubound(hdVals)
    if i = 0 then
        response.Write "<td class=""symbollng"" valign=""bottom"" style=""border-right:0px; border-left:0px;"">" & hdVals(i) & "</td>" & vbnewline
    elseif i = 1 then
        response.Write "<td class=""close-hd"" valign=""bottom"">" & hdVals(i) & "</td>" & vbnewline
    else
        dstrVals(i-2,0) = hdVals(i)
        response.Write "<td class=""col-hd-wd"" valign=""bottom"">" & hdVals(i) & "</td>" & vbnewline
  开发者_开发问答  end if
Next
%>
</tr>
</thead>



<tbody class="scrollContent">
<%
EO = "odd"
For i = 1 to Ubound(tmpRows)-1  
    if EO = "odd" then
        response.Write "<tr class=""grey"">" & vbnewline
    else
        response.Write "<tr>" & vbnewline
    end if
    tmpRowVals1 = split(tmpRows(i),"=")
    tmpRowVals = split(tmpRowVals1(1),":")
    For j = 0 to Ubound(tmpRowVals)
        if j = 0 then
            response.Write "<td class=""symbollng""><span title=""" & tmpRowVals(j) & """>" & tmpRowVals(j) & "</span></td>" & vbnewline
        elseif j = 1 then
            if trim(tmpRowVals(j)) = "" then
                response.Write "<td class=""close"">&nbsp;</td>" & vbnewline
            else
                response.Write "<td class=""close""><span title=""" & tmpRowVals(j) & """>" & tmpRowVals(j) & "</span></td>" & vbnewline
            end if
        else
            Call addToDistChart(j-2,tmpRowVals(j))
            gTime = hdVals(j)
            response.Write getCellColorWithClick(curlv(tmpRowVals(j)),tmpRowVals(0),gSec,gChar,gTime)
        end if
    Next
    response.Write "</tr>" & vbnewline
    if EO = "odd" then
        EO = "even"
    else
        EO = "odd"
    end if
Next
%>
</tbody>
</table>

Here is a picture of the design I have so far for the table:

Tbody Scrollbar Problem

Hopefully its a small edit in my code since dealing with tables has been a pain :(


There's a really simple jQuery-based solution at fixedheadertable.com.


Found a solution, its a jquery plugin that formats tables and autodetects the values in the columns which can sort them correctly. It also produces a nice ui interface that can be styled to your liking:

http://www.datatables.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜