Re:React Table v7 – Hooks for building fast and extendable d...
by nullorundefined on Tuesday March 10, 2020 @04:37PM
(#22539419)
does it have merged cells? we've had to in-house tables for this alone
[ Parent
| on HN ]
Re:React Table v7 – Hooks for building fast and extendable d...
by tannerlinsley on Tuesday March 10, 2020 @04:39PM
(#22539439)
A plugin is currently in development to make this extremely easy and turn-key, but for now (since you control the rendering layer), you can do this on your own with a few lines of code in your table renderer.
Re:React Table v7 – Hooks for building fast and extendable d...
by quink on Tuesday March 10, 2020 @05:21PM
(#22539846)
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.
Re:React Table v7 – Hooks for building fast and extendable d...
by tannerlinsley on Tuesday March 10, 2020 @05:27PM
(#22539894)
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 ;)
Re:React Table v7 – Hooks for building fast and extendable d...
by tannerlinsley on Tuesday March 10, 2020 @04:39PM
(#22539443)
DM me on twitter and we can discuss more there. @tannerlinsley