Header and Row width mismatch when scrollable= true in DataTable
I'm submitting a ... (check one with "x")
[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Plunkr Case (Bug Reports) Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.
https://embed.plnkr.co/d9hQLeW3r95SMtCioTqt/
Current behavior
As you can see in the above plunker example, the header row have by default space for the scroll space even though there are not enough record to enable the vertical scrolling. I was using PrimeNg 1.0.0 RC1 and the scroll feature was dynamic and and didn't interleave a space but with the update to 2.0.0 the problem persisted.
Expected behavior
The default header space which cause the Header row out syn with the data column to be removed by default if not enough data.
Minimal reproduction of the problem with instructions
https://plnkr.co/edit/NEiGwhses3B7t84LT3mQ?p=preview
But with the scrollable feature turned on.
What is the motivation / use case for changing the behavior?
The data row is out of sync with the header when the data is less than the min scrollable height. Please tell us about your environment:
Windows 7, WebStorm, npm, webpack
- Angular version: 2.0.X
2.2.3
- PrimeNG version: 2.0.X
2.0.0
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
All
-
Language: [all | TypeScript X.X | ES6/7 | ES5] All
-
Node (for AoT issues):
node --version=
v6.9.1
Any Update on this? I have the same issue using 2.06
This should be fixed in recent PrimeNG release, please try with it and if the issue persists drop a comment with along with a test case based on plunkr below and we'll review again.
http://plnkr.co/edit/Wj39h1?p=preview
I tried to use table with scrollbar but same issue I faced in our application. Then I check at Primeng documentation of this table implementation. I found the same problem when user zoom the browser window. Could you please look into this. Many thanks in advance. https://www.primefaces.org/primeng/#/table/scroll
I got same issue, I was identified like : if we click on table header like try to sort, it is aligning properly. So what i did , added "id" attribute in table header for any column , and trigger that with click event,
Example
html part :
<I:thead> <i:tr> <i:th width="5%"> <i:th width="25%">Student <i:th width="15%">Total Marks <i:th width="15%" id="resetDatatable">Marks <i:th width="5%">% <i:th width="35%">Info </i:tr> </I:thead>
Script part :
var datatable = $('#ResultTable').DataTable({ "scrollX": true, "scrollY": "250px", "scrollCollapse": true, "paging": false, "initComplete": function(settings, json) { setTimeout(function() { $("#resetDatatable").trigger( "click" ); },1000); } } );
it worked for me. after table loaded, it is resetting columns in next second.
Try.