Search code examples
jsfjsf-2richfaces

extendedDataTable - height doesn't work


So, like the title says in my case height of the extendedDataTable doesn't work, so my table also doesn't scroll because all rows are shown. I'm using richfaces4.0-final version. So here is my piece of code:

        <rich:extendedDataTable
            value="#{advancedSearchView.criteria}" var="criteria"
            height="50px"
            selection="#{advancedSearchView.selection}" id="table"
            selectionMode="single">
            <rich:column id="criteria_row" filterBy="#{criteria}" filterEvent="onkeyup" width="500px">
                <h:outputText value="#{criteria}" />
            </rich:column>
        </rich:extendedDataTable>

AdvancedSearchView is request scoped bean, and criteria is an array of Strings.

I hope that is enough information. Thank you in advance. A would really appreciate if someone gives me an answer, because I'm struggling with this for a while.


Solution

  • According to the RichFaces 4 VDL (View Declaration Language) documentation, the <rich:extendedDataTable> component does not support the height attribute at all.

    Your functional requirement is however understood. You want to render the extended datatable with a height of 50px and make the table body scrollable. You need to achieve this using the usual CSS means by style attribute which can take inline CSS declarations, or by the styleClass attribute which can take CSS classes, like as on almost every other JSF HTML component.

    So, with style

    <rich:extendedDataTable ... style="height: 50px;">
    

    or, with styleClass (which is also the more recommend practice; separate style from markup)

    <rich:extendedDataTable ... styleClass="criteria">
    

    and this piece in a CSS file which you include by <h:outputStylesheet />:

    .criteria {
        height: 50px;
    }