Skip to content

How to use rowSpan? #2233

Apr 26, 2020 · 9 comments · 19 replies
Discussion options

You must be logged in to vote

Okay made it work. Guess I just had to flatten the data. It was as easy as just copying & pasting your code. Here's the working solution:

import * as React from "react";
import { useTable } from "react-table";

type Data = {
  actor: string;
  movie: string;
};

const borderStyle = {
  border: "1px solid gray",
  padding: "8px 10px"
};

function useInstance(instance) {
  const { allColumns } = instance;

  let rowSpanHeaders = [];

  allColumns.forEach((column, i) => {
    const { id, enableRowSpan } = column;

    if (enableRowSpan !== undefined) {
      rowSpanHeaders = [
        ...rowSpanHeaders,
        { id, topCellValue: null, topCellIndex: 0 }
      ];
    }
  });

  Object.assign(i…

Replies: 9 comments 19 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@RichMie
Comment options

@manoharanamphora
Comment options

@df-peejay
Comment options

@MDziurakh
Comment options

@DatTN95
Comment options

Answer selected by deadcoder0904
Comment options

You must be logged in to vote
2 replies
@nl3v
Comment options

@nl3v
Comment options

Comment options

You must be logged in to vote
7 replies
@ljubomirsinadinovski
Comment options

@aliabdollahy
Comment options

@noorqidam
Comment options

@ljubomirsinadinovski
Comment options

@azhoang-sts
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@deadcoder0904
Comment options

@tushar1998
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment