keeping the header fixed in datatable while allowing its contents to scroll

Posted by Sunny Mate on Stack Overflow See other posts from Stack Overflow or by Sunny Mate
Published on 2010-04-09T08:46:12Z Indexed on 2010/04/09 11:43 UTC
Read the original article Hit count: 214

Filed under:

I have a table with header and data. When I am scrolling the header is also getting scrolled my code is as follows:

<div style="height:200px;overflow-x:auto;overflow-y:scroll;">
    <h:dataTable cellpadding="0" cellspacing="0" border="0" width="60%"
        headerClass="HeaderCellSorted" columnClasses="DataCell" rowClasses="OddRow,EvenRow" styleClass="SearchResults" footerClass="FooterCell" 
        id="userListTable" value="#{pc_WorkInProgressUserGrid.userGridModel.rebalanceByUserList}" var="userGridDO">
        <h:column id="userNameColumn">
            <f:facet name="header">
                <h:outputLink id="userNameColumnLink" styleClass="Header" value="#" onclick="refreshUserGrid('DISPLAYNAME')">
                    <h:outputText id="userNameColID" styleClass="outputText" value="User"/>

Any suggestion would be helpful.

© Stack Overflow or respective owner

Related posts about jsf