jQuery FixedHeaderRow script - dynamic scroll width (how to control)
<asp:Panel ID="Panel2" style="width:720px; border-style: outset; border-width: 4px; " runat="server" ScrollBars="Horizontal开发者_JS百科">
<script src="Scripts/jquery-1.2.6.js" type="text/javascript"></script>
<script src="Scripts/webtoolkit.jscrollable.js" type="text/javascript"></script>
<script src="Scripts/webtoolkit.scrollabletable.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
jQuery('#<%=GridView2.ClientID%>').Scrollable(400, 2000);
});
</script>
<asp:GridView ID="GridView2" runat="server"
DataSourceID="SqlDataSource1" OnPreRender="GridView2_PreRender"
onrowcreated="GridView1_RowCreated" Width="100%"
ondatabound="GridView2_DataBound" CellPadding="4" ForeColor="#333333"
GridLines="both">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
When column count is about 20 it looks like perfect (except: I can't see vertical scroll bar before scroll horizontal scrollbar to the right scope)
But when column count is 4 I've got same 2000 width and 500pt for each column and horizontal scroll :-S that's fail.
Is there some way I can control this width ???
thank you.
I believe that the width property is optional. If you don't set it, the jquery script should take the current table width as a default.
精彩评论