nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Table prop <removewrapper> can't use along with <isvirtualized>

Open gaozp opened this issue 9 months ago • 2 comments

HeroUI Version

2.7.4

Describe the bug

1000 item:

Image
import { Button } from "@heroui/react";
import type { MetaFunction } from "@remix-run/node";

import {  Table,  TableHeader,  TableBody,  TableColumn,  TableRow,  TableCell} from "@heroui/table";

function generateRows(count : Number) {
  return Array.from({length: count}, (_, index) => ({
    key: index.toString(),
    name: `Item ${index + 1}`,
    value: `Value ${index + 1}`,
  }));
}

export const meta: MetaFunction = () => {
  return [
    { title: "New Remix App" },
    { name: "description", content: "Welcome to Remix!" },
  ];
};

export default function Index() {
  const rows = generateRows(1000);
  const columns = [
    {key: "name", label: "Name"},
    {key: "value", label: "Value"},
  ];

  return (
    <Table
      isVirtualized
      isHeaderSticky
      removeWrapper
      aria-label="Example of virtualized table with a large dataset"
      maxTableHeight={500}
      rowHeight={40}
    >
      <TableHeader columns={columns}>
        {(column) => <TableColumn key={column.key}>{column.label}</TableColumn>}
      </TableHeader>
      <TableBody items={rows}>
        {(item) => (
          <TableRow key={item.key}>
            {(columnKey) => <TableCell>{item[columnKey]}</TableCell>}
          </TableRow>
        )}
      </TableBody>
    </Table>
  );
}


Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

import { Button } from "@heroui/react";
import type { MetaFunction } from "@remix-run/node";

import {  Table,  TableHeader,  TableBody,  TableColumn,  TableRow,  TableCell} from "@heroui/table";

function generateRows(count : Number) {
  return Array.from({length: count}, (_, index) => ({
    key: index.toString(),
    name: `Item ${index + 1}`,
    value: `Value ${index + 1}`,
  }));
}

export const meta: MetaFunction = () => {
  return [
    { title: "New Remix App" },
    { name: "description", content: "Welcome to Remix!" },
  ];
};

export default function Index() {
  const rows = generateRows(1000);
  const columns = [
    {key: "name", label: "Name"},
    {key: "value", label: "Value"},
  ];

  return (
    <Table
      isVirtualized
      isHeaderSticky
      removeWrapper
      aria-label="Example of virtualized table with a large dataset"
      maxTableHeight={500}
      rowHeight={40}
    >
      <TableHeader columns={columns}>
        {(column) => <TableColumn key={column.key}>{column.label}</TableColumn>}
      </TableHeader>
      <TableBody items={rows}>
        {(item) => (
          <TableRow key={item.key}>
            {(columnKey) => <TableCell>{item[columnKey]}</TableCell>}
          </TableRow>
        )}
      </TableBody>
    </Table>
  );
}


Expected behavior

Can use this two prop together.

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

gaozp avatar Mar 06 '25 08:03 gaozp

I encounter the same predicament.

shencangsheng avatar May 16 '25 08:05 shencangsheng