Hacker News new | ask | show | jobs
by quink 2293 days ago
What I did to merge cells but keep the headers the same was to just suppress rendering via

    if (isFakeColumn(cell.column.id)) {
      return <React.Fragment key={cell.column.id}></React.Fragment>;
    }
And then render it with another column:

    {cell.column.id === "title" ? (
      <>
        {cell.render("Cell")}
        <br />
        {row.cells[2].render("Cell")}
        <br />
        {row.cells[3].render("Cell")}
        {" ยท "}
        {row.cells[4].render("Cell")}
      </>
    ) : (
      cell.render("Cell")
    )}
There's probably a way to get at the lot via a string, but by index was quick and easy enough.

One thing I do have to complain about is the lack of native TypeScript support - there used to be types in the repo, but they got removed. And `prepareRow(row)` is a bit ugly, but nothing major and it's only a one-time call.

1 comments

Yeah, I'm sorry that's the case now. Having the types as first-class citizens of the repo while the library was not written in TS or maintained by TS devs was a big mistake. They are still available (and will updated asap from some other great devs) in DT. The prepareRow function may be ugly, but not as ugly as a freakishly slow table with only a handful of rows and columns visible at once ;)