Live data from Hacker News

Do you know that there is an HTML tables API?

christianheilmann.com

161–170 of 206 posts

Re: Do you know that there is an HTML tables API?

#161
post #125
post #101

The trouble is not populating it. The trouble is that tables, even though structured semantically, give you absolutely no functionality. There are no search, filter, sort, or selection features that you get.

Compared to what? What gives you all that, and what prevents you from having it with tables?

Javascript arrays have functions for all of that, so if you use something like React and renders your table from data arrays then it's all pretty trivial. I guess the point is that if you have to use JS to do those manipulations, then at some point it's going to be easier to just the React(/Vue/Svelte/etc) approach than manipulating the table yourself using the API described in the article.

Re: Do you know that there is an HTML tables API?

#162

Earlier quoted context omitted.

Because not everyone has useful eyeballs. Some people are blind. The amount of extra work you have to do to make a div faithfully act like a button is far more than simply resetting some styles.

It seems evident to me that semantics are more challenging to define than visuals; it's not the CSS that's the problem.

It's more challenging to encourage correct implementation of semantics than implemention of visuals; which is a great reason for using the element that was designed for this use case.

Re: Do you know that there is an HTML tables API?

#163

Earlier quoted context omitted.

HTML tables are cognitively if not officially deprecated these days. I made my 1996 resume in HTML using a table for layout and it was indistinguishable from the Word version when printed. Made by editing the HTML by hand too! Tables are great. I don't doubt that CSS stuff is more capable, but the old ones are still useful.

Back in the early to mid 2000's, making your site "table free" while still working on IE6 was seen as a badge of masochistic pride. Doing table-free multi-column layouts involved doing crazy “float: left/right + padding + margin” with an heavy sprinkle of IE6 clearfix hacks to work right. I mean eventually people dialed in the correct incantations to make table-free designs work for IE6 but it was never quite as stra…

I remember those days. It was simpler to use tables for layout than to use early CSS for quite a while.

Re: Do you know that there is an HTML tables API?

#164

Earlier quoted context omitted.

And spans for creating links…

Thereby forgetting that some people like to open links in a new tab.

And for the ones that remember to implement middle-mouse click to open new tabs, forgets that one can also do CTRL+click to open in new tab, or vice-versa.

Just use please :)

Re: Do you know that there is an HTML tables API?

#165
post #152

Earlier quoted context omitted.

And, not a single one of the declarative frameworks use the HTMLTableElement API!

So how they do they talk to the browser to add a row to the table? Do you know of any API other than DOM used for this?

They use createElement instead of the table-specific API.

Re: Do you know that there is an HTML tables API?

#166

Earlier quoted context omitted.

rowIndex isn’t that short.

shortness is in the eye of the beholder… program with spring framework long enough and rowIndex sounds like abbreviation. :)

  RowIndexFactoryGeneratorService rowIndexFactoryGeneratorService = new RowIndexFactoryGeneratorService();
  RowIndexFactory rowIndexFactory = rowIndexFactoryGeneratorService.getTheFactoryOrSomethingIDontCare();
  RowIndex rowIndex = rowIndexFactoryGeneratorService.generateRowIndex();

Re: Do you know that there is an HTML tables API?

#167
post #2

Tables died (thankfully) to make room for flex and grid. I can't see any use case for them at all anymore.

How about displaying data in rows and columns in a accessible and easily styled way, without having to rely on JS and your own CSS to replicate a table? How exactly would you do that with HTML and CSS without using tables? Using flex and grid for those purposes don't make much sense unless you care about design above all else. just gives you so many good defaults (semantic structure, accessibility, column styling, co…

Nothing about flex or grids requires JS. That's entirely CSS.

Re: Do you know that there is an HTML tables API?

#169
post #2

Tables died (thankfully) to make room for flex and grid. I can't see any use case for them at all anymore.

How about displaying data in rows and columns, like records in a database? Or have you forgotten SQL, because you retrieve JSON from your 1000 NoSQL microservices?

Rows and columns are exactly what grid was added to CSS for.

Re: Do you know that there is an HTML tables API?

#170

I was using it just half a year ago, after either reading MDN or reading what AI suggested. Which means, this API is not obscure and not forgotten. Using `rows` and `cells` is very convenient for keyboard navigation across table cells. https://github.com/ClickHouse/ClickHouse/blob/master/program...

The worst thing on the modern web is people using divs for table data. What do you mean this table isn’t sortable? M365 Admin is the worst offender I’ve come across on this. Just terrible table implementations on almost every page.

Using HTML Tables doesn’t just make your data sortable
Post reply on HN