DataTable - Sticky Header

Header of the datatable can be fixed to keep it in viewport during scroll.

IdYearBrandColor
fb7790641960JaguarGreen
e7d740ea1966FiatWhite
2f6961211964MercedesBlack
f3631efb1987MercedesWhite
f1a3316e1965FiatWhite
3958bc3c1969FordBrown
b56bca441965MercedesYellow
810b85952001MercedesOrange
ef67ef8e1986RenaultWhite
fc1f66b52000VolkswagenGreen
8bf13da91966BMWGreen
61d8ac031993BMWYellow
9a0773082009HondaRed
1f3d3b922001FordYellow
ebcdad182007FordSilver
56d1f2e41993RenaultBrown
c929166b1985VolvoMaroon
0945c1af1990FiatBlack
7b24d6251994FiatSilver
7638de362008VolkswagenBlack
92a5bea21974FordSilver
8d2a26a41987RenaultWhite
d4a7b4341990FordMaroon
4b37858a2006AudiGreen
4296baaa1973AudiGreen
4a0d98b41992BMWOrange
2955e8e21991FiatYellow
735c0a671971VolkswagenBlue
14b160342004FordBlack
cf80e9cb1986VolkswagenBrown
e6c3a62f1961BMWBlack
3e1af07d2005AudiGreen
f3c853b81997VolkswagenSilver
5fdbd61c1966FiatRed
bf72d9411977FordMaroon
25f0b74f1999VolkswagenYellow
28046a041994BMWBrown
02c5a0972007FiatWhite
53dadb261985VolvoRed
0eb75ee11971BMWOrange
e42ab85d2000VolvoYellow
3fd6c8ae1987VolkswagenSilver
181dacfb1995VolvoYellow
b806d6121961VolvoOrange
5744323d1964BMWOrange
ec22ef971989VolkswagenRed
e068cb9d2009MercedesGreen
15392bf81996BMWBlue
ce447a6c2008MercedesBlack
206088721983FiatRed
<p:dataTable var="car" value="#{dtStickyView.cars}" stickyHeader="true">
    <p:column headerText="Id">
        <h:outputText value="#{car.id}" />
    </p:column>
    <p:column headerText="Year">
        <h:outputText value="#{car.year}" />
    </p:column>
    <p:column headerText="Brand">
        <h:outputText value="#{car.brand}" />
    </p:column>
    <p:column headerText="Color">
        <h:outputText value="#{car.color}" />
    </p:column>
</p:dataTable>