Scrollable datatable: column header still not matching!

UI Components for JSF
User avatar
Daedalus
Posts: 164
Joined: 28 Jan 2010, 12:03

08 Feb 2011, 12:18

Hello,

even with Version 2.2 and using fixed with in every p:column (which is by the way a very hard restriction), the columns still don't match the size of the headers in my opinion common scenarios.

Steps to reproduce :

1. Render a scrollable table with fixed width on every column. -> The columns headers matches the columns -> everything is ok (for now)
2. Select an entry and edit a value. Use a long (big size) value without white-spaces for example : "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
3. Save the value, update the Table.
4. Result:
Image
Last edited by Daedalus on 08 Feb 2011, 12:25, edited 1 time in total.
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Feb 2011, 12:24

Have you compared with working example?

http://www.primefaces.org/showcase/ui/d ... olling.jsf

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Feb 2011, 12:25

I think you need to use table-layout fixed to avoid overflows in widths.

User avatar
Daedalus
Posts: 164
Joined: 28 Jan 2010, 12:03

08 Feb 2011, 12:28

Sure this is easy to reproduce in showcase have a look:

Image


Edit:

table-layout fixed ? where can I set this?
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,

fajo
Posts: 37
Joined: 07 Jul 2010, 14:52

08 Feb 2011, 12:46

It is really strange, I tried to fix the values of the columns, but nothing changes.
I spent all day yesterday trying to adapt my project to the new changes.
Not to mention that when we define the scrollable property, even if the datatable has no contents, empty space is reserved on the page defined in height.
Last edited by fajo on 08 Feb 2011, 12:59, edited 1 time in total.
Netbeans 7.0.1
Mojarra 2.1.0
JavaEE 6
Primefaces 3.0.1

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

08 Feb 2011, 12:50

I just entered this issue a few days ago...

http://code.google.com/p/primefaces/iss ... &start=300

table-layout: fixed is a css property, the default is auto which apparently
goes through your data looking at column data widths to determine the
optimal column width. I've not found a good description of the algorithm
used, and I've not tried too hard either.

From my perspective nothing other than tables that automatically layout
is good enough for me to use, it's just too much hassle to go through each
and every table setting column widths, I've got loads of them.

I'm using tables with css overflow: auto, the big problem being that header
and footer data scrolls along with the row content, which isn't great.

Is it really that difficult to get this working? surely dataTable is THE no.
1 component???

User avatar
Daedalus
Posts: 164
Joined: 28 Jan 2010, 12:03

08 Feb 2011, 13:13

Ah ok I found the css property with the help of google:

And here are the results: Table headers are fine now but the the text is now written over the other columns instead :cry:

Image
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,

User avatar
Daedalus
Posts: 164
Joined: 28 Jan 2010, 12:03

08 Feb 2011, 14:38

Ok I guess I found a working solution!

Add word-wrap: break-word to your p:column style and use "table-layout: fixed" for the tables inside the p:dataTable

<p:column style="width: 150px; word-wrap: break-word;" >
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,

fajo
Posts: 37
Joined: 07 Jul 2010, 14:52

08 Feb 2011, 15:13

The above tip worked, now would not set a fixed width for columns even when it is empty, query screens, the first appears empty datatable with the columns and set the headers and then displays when the result of a research is that the columns are not adjusted for the defined sizes.

Why not be like when you put the Paginator, it automatically distributes the columns between the width of the container, after all, not everything datatable.
Netbeans 7.0.1
Mojarra 2.1.0
JavaEE 6
Primefaces 3.0.1

MikeK
Posts: 104
Joined: 13 Oct 2010, 15:07

08 Feb 2011, 16:47

This workaround does make the column headers and data align when there is data but it does not work when you have an empty dataset. I also agree with others that setting a fixed width in pixels for columns is not a great solution. This could be a big issue for my project.
Prime Faces 6.2
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests