Back to Nocobase

SortableRow

docs/docs/en/shared-components/table/sortable-row.md

2.1.19728 B
Original Source

SortableRow

SortableRow is used to customize the draggable row of an antd Table.

Basic Usage

tsx
import { DndContext } from '@dnd-kit/core';
import { SortableContext } from '@dnd-kit/sortable';
import { SortableRow } from '@nocobase/client-v2';
import { Table } from 'antd';

<DndContext>
  <SortableContext items={records.map((record) => record.id)}>
    <Table rowKey="id" components={{ body: { row: SortableRow } }} columns={columns} dataSource={records} />
  </SortableContext>
</DndContext>;

API

PropTypeDescription
rowIndexnumberCurrent row index
classNamestringCustom class name