Skip to content

How to use rowSpan? #2233

Apr 26, 2020 · 9 comments · 29 replies

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 29 replies

You must be logged in to vote
0 replies

You must be logged in to vote
0 replies

You must be logged in to vote
15 replies
@michaelsawyers

@kapoor17

@mindkeeper

@AdnanTheExcellent

@michaelsawyers

Answer selected by deadcoder0904

You must be logged in to vote
3 replies
@nlevnaut

@nlevnaut

@tvone

You must be logged in to vote
7 replies
@ljubomirsinadinovski

@aliabdollahy

@noorqidam

@ljubomirsinadinovski

@azhoang-sts

You must be logged in to vote
0 replies

You must be logged in to vote
0 replies

You must be logged in to vote
4 replies
@deadcoder0904

@tushar1998

@itskazemk

@tushar1998

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
Labels
None yet