by mbrock · 13y ago · 0 comments
We've spent a lot of time implementing this ourselves for a data table containing lab analysis values. It's a big requirement from our customers. You can imagine it's pretty important to be able to match rows and columns (sample types and dates) correctly when you're looking at these values.
The planning meeting about this was pretty funny.
Boss: "So, we'll just make the headers fixed, should be easy, right?"
Developer: "Heh-heh... Yeah, we could probably get that working decently in just a couple of weeks. We'll have to test it in all the browsers, of course, and do performance tests with big data sets. It's possible that we might not be able to get it to work well enough on all platforms, so we should have a backup plan."
Boss: "Sigh. This would be so much easier in Visual Basic..."
The issue of fixed headers is a styling issue, not an issue of what embedding types are supported; and that is solved by the "position: sticky" CSS attribute that this link discusses. There has been an experimental WebKit implementation of this for a while, this now adds an experimental Gecko implementation. Hopefully this will be standardized soon and available in non-experimental form.
If I want a fixed header on a table. Couldn't I just fix the body height on the tbody, and use an overflow: scroll, to achieve the same effect? or am I missing something?
Forgive me as I'm still unsure as to what position:sticky actually means. Is it to keep the headings on screen?
The header cells end up being layouted separately from the body cells, and so their widths are not constrained together.
Actually, I'm not sure if sticky positioning is different in this regard... This property might not solve the problem we ran into.
In any case, a sticky header is different from an absolute header, because it doesn't require a separate scrolling container. You just scroll the page, and the header follows along, until the table scrolls out of the viewport.
It's attempting to make something perform in a way it was not designed, nor intended, for. Just because a Honda Civic can't compete in an F1 race doesn't mean the Civic is broken.
It is a broken experience, and a defect in the HTML concept of a "table".
Honestly, we have to stop defending these terrible web technologies we're saddled with. We use them because they're the only universal-standard client application engine.
Not because they're good.
I would think that people who relied on books before computers came along would disagree.
HTML provides for a means to view tabular data and performs that function in a minimal and acceptable manner. People moving the goal posts on the requirements does not mean the current implementation is "broken" nor "defective". It simply does not perform an extra feature that people would like to have today.
I also don't believe I was defending anything, I was simply disagreeing with an unfair criticism against a technology because it wouldn't do what it wasn't designed to do based on current expectations.
The simple fact that HTML/CSS/Javascript allows for it to be extended and expanded shows it is not a defective means of displaying information. It means that there's the occasional lag in updating the specs to meet people's current expectations. Blame the people not keeping the spec up to date with current expectations and not the spec.
Once position:sticky is in common use I suppose we'll wait until the next new expectation of functionality appears that means something is "broken".
HTML/CSS/Javascript is good in many ways, but I agree it is not perfect and it never will be.
Actually I think most in HN disagree with that. In HN taking the native side is a sure way to get downvotes.