-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto fit with column toggle and scroll width is not working in turbotable #5510
Comments
Scrollable tables do not support auto table layout, they must have fixed table-layout for the alignment of the headers and body. |
tl;dr: I have managed to get scrolling, column reordering, column resizing AND mock-autofit to work together by hooking into p-table's state feature. I have worked around the limitation by hooking into p-table's state feature. On my p-table I set
Then before my table is initialized the first time, I check whether the state exists or not. If it doesn't exist I calculate the longest text width across all my columns and rows and save this in the table state store using this function
. Here is the function that iterates over all the data
This works better than I though it would. Obviously it doesn't cater for longer strings in the rest of the data in other pages, but it does at least set a minimum of 100px and once the user adjusts a column width, the new widths are stored in local storage. |
I used your example but now my data is not rendering when i added stateStorage and tableKey props.. any idea? |
Did anyone solve this issue? |
Is there any way to set percentage column widths on a p-table when using This setting changes the table to I have attempted to do this via I need the scrollable tables with fixed headers, but I can't have it setting all of the widths equally. |
Add this to your .scss: `.p-datatable-thead {
} .p-datatable-tbody {
} Above css enables [scrolleable]="true" to work with [width]="col.width". My problem now is getting this to work with [resizableColumns]="true". They all worked together in version 12.0.1. |
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
http://plnkr.co/edit/kyxWdwyG2heyRLnaiNA9?p=preview
Current behavior
though in the css it says auto fit to content i.e
table-layout: auto !important;
overflow:auto !important;
column of column toggle are in the same size and not fit to content
Expected behavior
column of column toggle are fit to content
Minimal reproduction of the problem with instructions
create a table with column toggle and width scroll, put in the css auto fit to content and see your columns in table are in the same size and cells are overflow.
http://plnkr.co/edit/kyxWdwyG2heyRLnaiNA9?p=preview
What is the motivation / use case for changing the behavior?
have a big nice table.
Please tell us about your environment:
NA
Browser: all
Language: all
Node (for AoT issues):
node --version
=The text was updated successfully, but these errors were encountered: