Hacker News new | ask | show | jobs
by colecut 1253 days ago
Why is there no standard/widely used vanilla-js based webcomponent for creating a table with filtering+sorting+pagination? It's such a common and useful thing.
4 comments

I assume that it's because there's basically no upper scope limit, and it's not obvious where the cut should be done.

Just take filtering - there are so many possibilities of how filters can look like, how can they be combined (AND, OR, nested) etc.

That. Basically a `f` in `filter(f, collection)` is code which can be arbitrary business logic.
Possibly the same reason there's no standard way to get a file browsing widget from a linux native applications, despite it being a common and useful thing.
What do you mean? There are tons of these around. Are you complaining that none of them are popular enough?
None of them are standard. It should be baked into the cake. It's been a puzzler to me since I started programming over 20 years ago. Every third-party library existed basically just to provide a usable grid because most everything else was good enough. Combo boxes and date pickers too but those were less of a pain to implement.
The eventual aim of Open-UI is to establish a set of standard UI components like this.

> The purpose of Open UI to the web platform is to allow web developers to style and extend built-in web UI controls, such as <select> dropdowns, checkboxes, radio buttons, and date/color pickers.

> Today, component frameworks and design systems reinvent common web UI controls to give designers full control over their appearance and behavior. We hope to make it unnecessary to reinvent built-in UI controls

https://open-ui.org/

There's various bits and pieces around the margins of grid/table/sorting that make it so it doesn't surprise me that it's not natively provided.

But the lack of a combobox in HTML, I don't get at all. datalist kind of sort of does it but not quite, plus it's inconsistently implemented as to what it actually shows.

> None of them are standard.

If there were a standard, you'd probably still complain that it doesn't match your use-case.

Notion table seems to be close to generic. Basically let users provide a `f` in `filter(f, collection)`.