0
votes

I have a problem with a dataTable using PrimeFaces 3.2.

The DataTable content is too wide for the given div. So I need to make the content of the div / form scrollable. When I use style="x-overflow: auto / scroll" nothing is changed.

The generate html looks like:

<div id="content" style="width: 500px;">
  <form id="j_id1241625851_2_2315c4de" class="ui-widget ui-widget-content ui-shadow ui-corner-all" style="x-overflow: scroll;" enctype="application/x-www-form-urlencoded" action="/data.xhtml" method="post" name="j_id1241625851_2_2315c4de">
   <div id="j_id1241625851_2_2315c4de:serverdata" class="ui-datatable ui-widget">
    <table role="grid">
     <thead> ...
     </thead>
     <tfoot>
     <tbody id="j_id1241625851_2_2315c4de:serverdata_data" class="ui-datatable-data ui-widget-content">
      <tbody id="j_id1241625851_2_2315c4de:serverdata_data" class="ui-datatable-data ui-widget-content">
       <tr class="ui-widget-content ui-datatable-even" role="row" data-ri="0">
        <td style="width: 200px;" role="gridcell">
        <td role="gridcell">
        <td role="gridcell">
        <td role="gridcell">
        <td role="gridcell">
        ...
       </tr>
       ...
     </tbody>
    </table>
   </div>
 </form>
</div>

So how can I make the content (e.g. the datatable) of the form scrollable?

1

1 Answers

2
votes

Since you are using primefaces

You can use scrollable and scrollWidth attributes

for example scrollable="true" scrollWidth="400"

take a look at the showcase DataTable - Scrolling