question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dataTable: given column width not used when having frozenColumns

See original GitHub issue

Describe the bug

I have a fixed column but the fixed column does not consider the given column width of 120px. Instead of the given column width of 120px, it uses a width of 50% of parent container:

<p:dataTable scrollable="true" scrollHeight="640" scrollWidth="500" frozenColumns="1" ..>

<!-- width is not 120px but 50% of parent container >
<p:column width="120px">
..
</p:column>

</p:dataTable>

Looking at the pf components.css:

.ui-datatable table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

changing to

.ui-datatable table {
  border-collapse: collapse;
  width: auto;
  table-layout: fixed;
}

will consider the given width of 120px but then when scrolling to the right, the column header does not start and begin with its column content.

Reproducer

No response

Expected behavior

Given p:column width must be considered.

PrimeFaces edition

None

PrimeFaces version

12

Theme

No response

JSF implementation

Mojarra

JSF version

2.3

Java version

jdk 17

Browser(s)

Firefox 107

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Dec 11, 2022

Yep a lot of them across PF allow you to use “100px” or “100%” or “100vw”. Whatever is typically available as CSS!

0reactions
nimo23commented, Dec 11, 2022

Yes, we can give the unit indeed. This is something which I did not know. When giving the unit as percentage the above case works without using setting width in .ui-datatable-frozenlayout-left. So I will close this issue. @melloware Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frozen columns width · Issue #708 · primefaces ... - GitHub
When we use the datatable frozen columns, the table is automatically separated into width 50% to each side, a frozen and thawed other....
Read more >
Set width of a frozen column - css - Stack Overflow
In order to change the width of the frozen columns, use the following CSS class: /* Change frozen width */ .ui-datatable-frozenlayout-left ...
Read more >
Column width not working — DataTables forums
The widths given are then applied to that table and the actual widths are read back from it. It does this to try...
Read more >
FrozenDataTable | PrimeFaces JavaScript API Docs
DOM element of the hidden input that holds the row keys of the rows that are expanded. Used to preserve the expansion state...
Read more >
Table | Overview | JET Developer Cookbook - Oracle
Simple Table with Javascript Array data configured to support the following features: High-Water Mark scrolling; Sorting; Selection; Column resize/reorder ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found