Datatable header not scrolling with body

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

I have a simple example of my problem. I am using Datatables 1. The column headers don't move when scrolling horizontally when the datatable is inside another html table. It works fine when it is not in the html table. My example was actually taken from their example on horizontal scrolling but I added the outer table. Any help would be appreciated. I have looked everywhere for the answer.

Here is the code. Move it into a div tag, and add position:relative ;overflow:auto; heightpx; to style. Learn more. Datatables - Column Headers don't move when scrolling horizontally Ask Question. Asked 6 years, 10 months ago. Active 8 months ago. Viewed 14k times.

6. Warning: Possible column misalignment

Here is the fiddle with your code jsfiddle. K Jun 11 '13 at Your fiddle shows the problem exactly. Their example does not have the outer html table. Try to fix the outer table width jsfiddle. K Jun 15 '13 at Active Oldest Votes.

Ahmed Sunny Ahmed Sunny 1, 1 1 gold badge 16 16 silver badges 19 19 bronze badges. Manoj Shekhawat Manoj Shekhawat 1 1 gold badge 2 2 silver badges 10 10 bronze badges.

Why is this better? Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Socializing with co-workers while social distancing. Podcast Programming tutorials can be a real drag. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Triage needs to be fixed urgently, and users need to be notified upon….Change the horizontal alignment of your nav with flexbox utilities.

If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0. A logo or brand link, and the navigations links. The setting vertical-align will be not really help you because it's inside of deep hierarchy of other dives and cells which will be not vertically centered and some from there have fixed coded height in If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor.

Whether you have your own style guide or just need a custom theme, Designer API is the right tool to design and bring them to existence. You can also use background lighten, darken and accent classes. Briefly about the platform. The only luxury which I cannot afford is duplication of data. Metronic is a responsive and multipurpose admin and frontend theme powered with Twitter Bootstrap 3. Assemble more bootstrap tutorial with examples now! To ensure everything lines up nicely, apply the same padding to heading cells as to data cells.

Disabling ScrollY solves the alignment problem. Here is a picture of a typical table displayed within a scroll pane: The rest of this section shows you how to accomplish some common table-related tasks. This can be useful in complex paned layouts. So the only way to scroll the table horizontally it to use my trackpad - which makes it difficult to scroll horizontally and not vertically at the same time.

When running the application, the header width is not aligned with the body width. As long the scrollbar is not entirely scrolled to the right, it is fine. Template contains all the important functions which must have one backend system.

You need to use various controls inside a line item, such as micro charts. I still have not resolved this and desperately need help.

How To Make Pure CSS Scrollable Table Fixed Header With Scrolling

This is how it looks when the page gets loaded: After clicking on the header: My datatable code: Hi, I've noticed that occasionally the horizontal scroll bars don't show up in a datatable, especially if the columns are fixed.

When we add frozen column in p:dataTable internally it create 2 component. Include "datatable-scroll" in your use line to enable the feature. Additionally popups can now specify a scroll context, to allow for scroll containers other than window to cause a clicked popup to hide on scroll.

It is only in Frozen column dataTable if we remove frozen column this issue is not reproducing. If you are using vertical scrolling scrollY and not horizontal scrolling scrollXenable the horizontal scrolling option so the table has space to scroll into.

Most DataTables extensions work on their own, but some may not work well when certain non-default features are enabled or used in Shiny apps.I have created the world's greatest web control. OK, it's more like I reinvented the wheel.

I present to you a cross-browser table with a fixed header and scrollable body. The magic is in a bit of tomfoolery. There are actually a few stacked controls. The code is produced with the following:. It doesn't look too impressive.

After all, it's nothing more than some carefully stacked controls. However, there are a few features that make this worthwhile. The most important is cross-browser compatibility.

The other major issue is that this does not work on mobile browsers. We have tried with iOS and Android. The reason is quite simple. Mobile browsers don't have scroll bars. If you need to make this work on a mobile browser, your best bet is to load a separate style-sheet that undoes everything.

Issues aside, let's tear into this thing. I want to first point out the issues that are pretty standard. This kills the slight differences between browsers with margins, borders, spacing, and padding. This is also why most of the large, block elements have defined widths. The next significant fact is the use of colgroup. Most of us dismiss this element when creating tables. However, it is one of the most effective ways to lock down column widths 2.

This is very important to us; we need our two tables to stay aligned. Now that the widths are OK, we have to lock down the heights. This is almost the sole source of magic. First, we fix the height of the containing box. Then, we fix the height of the header. Finally, we give the remaining room to the containing block for the body, minus 3 pixels for cross-browser rendering. It is definitely worth nothing that the body table does not have a height specified. This is necessary.

The rest of the magic comes from the overflow styles. Our first overflow tag is on the main block. We set the overflow to hidden. This tells the browser to simply hide anything that doesn't fit in the box 3. Then, we set the inner div to have an overflow of auto.

This tells the div to display scroll bars if the table is bigger than the div 4. That, in a nutshell, does it. Yes, there are a lot of cool extras you can pile on this framework. The version I developed is extremely more advanced than this. However, the bosses on let me give away so much free code.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Skin Builder doesn't have a preview for scrollable datatable.

I'm seeing this on 3.

Subscribe to RSS

The examples don't show the issue, I suspect it requires more than 2 columns in a y-scrolling datatable to show up, but I'm not sure of the exact trigger conditions. I'm not sure why this is assigned to skin builder though. Looks like a datatable column width explicit sizing bug with scrolling datatables.

The CSS there is the defaults in skinbuilder with some extra padding. I'm having the issue on Windows 7 in Chrome version I added a bit of CSS at the top to make it so if you change the skin on the example div to the default yui3-skin-sam it'll have the same enlarged padding to demonstrate that that works correctly. JDiPierro Thanks for figuring this out!

I was able to reproduce the fix by adding the CSS you correctly indicate was missing. JDiPierro I have applied the fix. Skip to content. This repository has been archived by the owner. It is now read-only. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up. Copy link Quote reply. This comment has been minimized. Sign in to view. I'm having this same issue. Has a solution ever been found? Can you provide a simple test case? Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in. Linked pull requests. You signed in with another tab or window.Thanks for letting us know about this.

datatable header not scrolling with body

I've seen this also happen in older IE version with zoom! I'll keep an eye out for it in Chrome as well. I was having similar problems when datatables was rendering to an hidden div, changing the render trigger solved the problem. This seems to be required for the JS to correctly calculate th widths in the docked header. I have resolved this issue by calling draw method on a separate call after creating the data table.

DataTables designed and created by SpryMedia Ltd. Privacy policy. SpryMedia Ltd is registered in Scotland, company no. Column Header not aligned with column data with horizontal scrolling - Page 2. February edited February February Hi, I was struggling with same issue and after reading many post here is how problem was "fixed". April I'm having a similar problem, and I've looked all through these forums trying many different fixes, with no consistant fixes.

So far, it works perfectly in FF, and IE For those looking for another potential fix for this type of problem, set a fixed width on the table, if your situation calls for it. In my case I put a px width on the table in css, and that takes the mathwork out of the problem.

It now works in all the browsers that I've tried it in. August Hi Guys, first post. I really dont know how to fix this, but if you can, tell users to restore default zoom view Cheers.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

datatable header not scrolling with body

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. Header columns and body columns should be aligned:. Why did you add 'table-layout: auto;'? Because when your dataTable is scrollable, you can see full-table-data by scrolling it. I think this issue should be resolved. I used a workaround javascript in my project. I called this script whenever the table contents changed, or on window resize.

It is a little clunky at times, and i feel this would work better if something like this was used within the primefaces code.

Datatables horizontal scroll header not aligned

I am still getting the alignment issue between header cells and data cells. Also, is there a way to limit the horizontal scrolling to only within the table and not the entire page? Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up. New issue. Jump to bottom. Copy link Quote reply.

datatable header not scrolling with body

No, it doesn't work on 6. This comment has been minimized. Sign in to view. Contributor Author. Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment. Linked pull requests. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. It was because of a small typo. I typed scrollx: true instead of scrollX: true. I have changed your jsFiddle to make it work the way you want it.

The header will now scroll with data as needed. Learn more. How to fix header not scrolling with body in datatables table Ask Question. Asked 10 months ago. Active 10 months ago.

Viewed 1k times. When scrollx is enabled the header doesn't scroll with the table body. I expected the header to scroll horizontally with the table body. Edit: I want to use the Scroller extension so I don't have any pagination. Could you please try to explain further that you are actually asking?

Scroll horizontally sorry. Active Oldest Votes. I found the solution after taking a break and looking at my code. I tried reproduce your case, it work normally. Hien Nguyen Hien Nguyen In your code, there is no scroller plugin, I want to use it so I don't have any pagination.

Thanks to your code, I found my error. Priyank Panchal Priyank Panchal 1, 1 1 gold badge 11 11 silver badges 17 17 bronze badges. Hardik Leuwa Hardik Leuwa 1, 8 8 silver badges 24 24 bronze badges. I want to be able to use Scroller with the table so I don't have any pagination.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *